VARIABLES AND ASSIGNMENT STATEMENTS
In [3]: y = 3
You can now use the values of x and y in expressions:
In [4]: x + y
Out[4]: 10
Calculations in Assignment Statements
The following statement adds the values of variables x and y and assigns the result to the variable total, which we then display:
In [5]: total = x + y
In [6]: total
Out[6]: 10
The = symbol is not an operator. The right side of the = symbol always executes first, then the result is assigned to the variable on the symbol’s left side.
Python Style
The Style Guide for Python Code helps you write code that conforms to Python’s coding conventions. The style guide recommends inserting one space on each side of the assignment symbol = and binary operators like + to make programs more readable.
Variable Names
A variable name, such as x, is an identifier. Each identifier may consist of letters, digits and underscores (_) but may not begin with a digit. Python is case sensitive, so number and Number are dif erent identifiers because one begins with a lowercase letter and the other begins with an uppercase letter.