Variables and Dynamic Typing
Know
A Python variable is a name bound to an object, and the type belongs to the object rather than to the name. Rebinding a name to a different type is legal.
Apply
Track what each name currently refers to, especially after reassignment inside a branch.
Watch out
Assuming a name keeps its original type. Nothing prevents it changing, and the error surfaces far from the cause.
Study move
Rebind one name to three different types and print the type after each.
