WEBVTT

00:00.000 --> 00:13.000
We'll explore a key concept in programming, variables, and by the end, you'll be able to,

00:13.000 --> 00:19.000
understanding what a variable is, how to create and use variables, why variables make your code

00:19.000 --> 00:28.000
efficient, and easy to update. What is a variable? A variable is a container for storing data in a program.

00:28.000 --> 00:35.000
For example, if you create a variable called age and set it to 25, the program will remember that value.

00:35.000 --> 00:40.000
If you later change age to 30, the program will automatically update the value.

00:40.000 --> 00:46.000
This allows the program to keep track of information that might change while it's running.

00:46.000 --> 00:57.000
Creating variables in Python. Let's create variables, type, name, lily, age, 12, here.

00:57.000 --> 01:07.000
The variable name stores the value, lily, and the variable age stores the value 12, printing variable values.

01:07.000 --> 01:16.000
To see the values of these variables, we use the print function, type, print, name, print, age.

01:16.000 --> 01:26.000
When you run the code, you will see the values lily and 12 printed on the console, changing variable values.

01:26.000 --> 01:36.000
Now let's update the values of the variables. Change the code to name, Emma, age, 15.

01:36.000 --> 01:44.000
Run the code again, and the new values, Emma and 15 will be printed on the console.

01:44.000 --> 01:50.000
This demonstrates how variables can easily be updated to hold different data.

01:50.000 --> 01:57.000
Why are variables important? Variables are important for two key reasons. Reusability.

01:57.000 --> 02:06.000
You can use the same variable in different places within your code without repeating the same information. Easy updates.

02:06.000 --> 02:14.000
If you change a variable's value, the entire program automatically updates to reflect the new value.

02:14.000 --> 02:20.000
Experiment by changing the values of your variables and running the code again.

02:20.000 --> 02:29.000
Programming is all about exploring different possibilities, so keep trying out new values and variables and see how they change the output.

