Python Variables
Variables are essentially a name attached to a specific Python object that is stored in memory. Once the object has been assigned to the variable, the program can interact with the object through referencing the name. Unlike other programming languages, a variable in Python doesn’t need to be explicitly declared before using. For example, a variable called “x” can be created and assigned when needed.
x = 10
The above variable, “x”, is assigned a value of 10.
Python Variable Names
Variable names can be short, ie. “x”, or longer and more descriptive, ie. SalesTax.
Variable names must start with a letter or an underscore. Variables can not start with a number.
Variable names are case sensitive. Ie. “x” and “X” would be considered two different variables.
TIP
Avoid using lowercase “l” and uppercase “I”, as well as uppercase “O”. These characters can cause confusion, because a lowercase “l” looks like an uppercase “I” and an uppercase “O” might look like an “0”.