Back to Python Mastery
BeginnerChildren
Introduction to Variables
Welcome to the world of Python! Today, we're learning about variables.
A variable is like a box or a container where you can store information. You give the box a name, and then you can put things inside it. In programming, we store data values in variables.
Let's look at an example. Imagine you want to store your name. You can create a variable called 'name' and put your name in it.
Here, 'name' is the variable, and "Alice" is the value we stored. The value is a piece of text, which we call a 'string' in programming. We usually put strings inside double quotes.
You can also store numbers:
Here, 'age' is the variable, and 10 is the number.
You can print your variables to see what's inside them:
This will show "Alice" and 10 on the screen. Now it's your turn to try!
A variable is like a box or a container where you can store information. You give the box a name, and then you can put things inside it. In programming, we store data values in variables.
Let's look at an example. Imagine you want to store your name. You can create a variable called 'name' and put your name in it.
name = "Alice"Here, 'name' is the variable, and "Alice" is the value we stored. The value is a piece of text, which we call a 'string' in programming. We usually put strings inside double quotes.
You can also store numbers:
age = 10Here, 'age' is the variable, and 10 is the number.
You can print your variables to see what's inside them:
print(name)print(age)This will show "Alice" and 10 on the screen. Now it's your turn to try!
Declare Variables
Declare a variable `name` with your name and an `age` variable with your age, then print a sentence.