Anyone know why i get an error when i use this variable name?
Also why do we often use under scores when naming variables in python?
e.g choice_number = {'rock':0,'paper':1,'scissors':2}
Because identifiers (variable/function/class names) cannot include spaces.
Cause they’re allowed, unlike spaces. This is known as snake_case
. This should be used for variable and function names. For class names, you should use PascalCase
.
4 Likes
Spaces are not allowed within variable names.
4 Likes