Python Variable
Computer programs use variables to remember important information, like items in a shopping cart, prices and discounts.
Variables are used to store the data that we need to store and manipulate in our programs.
Variables have a name and a value. To create a variable, you just need to give it a name, then connect the name with the value you need to store using the equal sign =.
A variable name in Python can only contain letters (a-az, A-Z), numbers or underscores(_). However, the first character cannot be a number.
userAge = 0
Every time you declare a new variable, you must give it an initial value. In this example, we gave it the value 0. We can always change this value in our program later.
We can also define multiple variables in one go.
userAge, userName = 30, 'John Doe'
This is equivalent to
userAge=30
userName= 'John Doe'
One value to multiple variables
You can also assign value to multiple variables.
x = y = z = "Red"
print(x)
print(y)
print(z)
Output
Red
Red
Red