|2.3 Variable names and keywords||13|
>>> print n
>>> print pi
In each case the result is the value of the variable. Variables also have types; again, we can ask the interpreter what they are.
Variable names can be arbitrarily long. They can contain both letters and num-bers, but they have to begin with a letter. Although it is legal to use uppercase letters, by convention we don’t. If you do, remember that case matters. Bruce and bruce are different variables.
The underscore character ( ) can appear in a name. It is often used in names with multiple words, such as my name or price of tea in china.
|14||Variables, expressions and statements|
Python has twenty-eight keywords:
A statement is an instruction that the Python interpreter can execute. We have seen two kinds of statements: print and assignment.
When you type a statement on the command line, Python executes it and displays the result, if there is one. The result of a print statement is a value. Assignment statements don’t produce a result.
Again, the assignment statement produces no output.