Variables
A variable is a name for a value. You give a variable its value with =. This is called assignment. Python creates the name the first time the assignment runs.
level = 1
print(level)
level = 2
print(level)
Output:
1
2
The second assignment gives level a new value, so the second print shows 2. Python lets a name hold a value of a different type later, for example text instead of a number. But if you use one name for two unrelated things, your program becomes harder to follow.
Variable names are case-sensitive. This means capital letters matter, so level and Level are two different names. Python names are usually written in lowercase, with an underscore between words, such as max_level.
To check what type a value is, use type(value). If you use a name that is misspelled or was never assigned, the program stops with a NameError.
Set and update the player's score in the exercise.