Whenever you define a function, Python searches the whole function for assignment statements. Any variable name that appears on the left side of an assignment, anywhere in the function, is considered a local variable for the entire function.
Any other variables are considered global variables (their values are sought outside the function).
No variables have values until you assign values to them.