Variable names in Python consist of letters, digits, and underscores, though they cannot begin with a digit. By
convention, words in variable names are separated by underscores, and the words themselves are usually all
lowercase. For instance, a_variable_name
would be a reasonable Python variable name.
The one exception to this convention is that sometimes code will assume that a variable is constant, and it will
break if that variable is changed while the program is running. Such variables' names are written in all uppercase
so that they stand out. For example, the constant $\pi$ should be named PI
because changing the value
of $\pi$ would almost certainly break a program that uses it.
Variables are not declared in Python; Python will create them when they are assigned to. While convenient, this increases the danger of misspelling because Python will not detect the error—it will just assign to a new variable with the misspelled name.
Assignments are written the same in Python as in Java, except that, again, idiomatic Python does not use semicolons at the end of statements. For instance,
PI = 3.141592653589793
would be an assignment that creates the constant PI
.
Fill in the placeholder so that the actual outputs match the expected outputs.