Variable names can never contain spaces.
bruceare different variables.
_) can also appear in a name. It is often used in names with multiple words, such as
price_of_tea_in_china. There are some situations in which names beginning with an underscore have special meaning, so a safe rule for beginners is to start all names with a letter.
76trombones = "big parade" more$ = 1000000 class = "Computer Science 101"
76trombonesis illegal because it does not begin with a letter.
more$is illegal because it contains an illegal character, the dollar sign. But what’s wrong with
classis one of the Python keywords. Keywords define the language’s syntax rules and structure, and they cannot be used as variable names. Python has thirty-something keywords (and every now and again improvements to Python introduce or eliminate one or two):
pi, it will somehow automagically calculate an average, or automagically associate the variable
piwith the value 3.14159. No! The computer doesn’t attach semantic meaning to your variable names.