Skip to main content

3.4) Variables: Important Rules And Advice (cont'd)


You can use numbers in the name but not at the start of the name. a2 is ok but not 2a.

>>> a = 2
>>> a2 = a * 2
>>> 2a = a * 2
SyntaxError: invalid syntax

Use meaningful names. Even if this takes longer to type out now, it will be worth it in the long run! It’s easier to understand what these lines do:

>>> radius = 2.5
>>> diameter = radius * 2