Variables are placeholders for important values. Programmers generally choose names for their variables that are meaningful. Variable names can be arbitrarily long. They can contain both letters and numbers, but they have to begin with a letter. It is legal to use uppercase letters, but it is a good idea to begin variable names with a lowercase letter. The underscore character (_) can appear in a name. It is often used in names with multiple words, such as my_name. You will get a syntax error if you use a multiple words variable name without the underscore character. For example, I will get a syntax error if I use ‘my name’ instead of ‘my_name’ as a variable name.
Python has reserved 31 keywords which are given below:
The python interpreter uses these keywords to recognize the structure of the program, and they cannot be used as variable names. If you give a variable an illegal name, you get a syntax error. In Python, equal sign (=) is used assign a variable name and remember that double equals == is used to test equality. A statement is a unit of code that the Python interpreter can execute. For example below is a print statement.
my_name = "Naveed Afzal"
A script usually contains a sequence of statements. If there is more than one statement, the results appear one at a time as the statements execute.
For example, the script
x = 2
produces the output