Store and read
Line 1 runs. Python makes the whole number 30 in memory and ties the name age to it. Read = as "store": it stores whatever is on its right.
Line 2 works out the right side first. Python looks up age, gets its current value, 30, and adds 1 to make 31. Reading a variable never changes it.
Then = stores 31 under the same name. The name age now refers to 31, and the old 30 is no longer reachable through it. A variable holds one value at a time.
Four types
price = 2.5 stores a float, a number with a decimal point. Whole numbers like 30 are int. The small tag under each box shows its type; type(price) tells you the same.
ok = True stores a bool. A bool has only two values, True and False, spelled with a capital letter and no quotes. Programs use them for yes-or-no answers.
Mixing types
Quotes make a str, a piece of text. "2" is the character 2, not the number two. For two strings, + joins them end to end, so "2" + "2" is "22".
int("2") turns the text "2" into the number 2, so this + adds: 2 + 2 is 4. str() goes the other way: str(4) gives the text "4".
Line 7 adds a str to an int. Python will not guess what you meant, so it stops with a TypeError and stores nothing. Convert one side first, with int() or str().
Try it in the Python prompt
;; step 1/8 · line 1: age = 30 >>> age = 30 >>> age 30 >>> type(age) <class 'int'>
The drawing gives each name one box. Strictly, a Python name refers to an object in memory, and reassignment makes the name refer to a new object (31) instead of the old one (30). An error that nothing handles stops the program, so in a script no line after line 7 would run.