May 2018
Beginner
472 pages
15h 3m
English
In the Python shell, create some variables. What happens when you try to put spaces, dashes, or other nonalphanumeric characters in the variable name? Play around with a few complex expressions, such as x = 2 + 4 * 5 – 6 / 3. Use parentheses to group the numbers in different ways, and see how that changes the result compared with the original ungrouped expression.
>>> x = 3 >>> y = 3.14 >>> y 3.14 >>> x 3 >>> big var = 12 File "<stdin>", line 1 big var = 12 ^ SyntaxError: invalid syntax >>> big-var Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'big' is not defined >>> big&var Traceback (most recent call last): ...