Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.
Well done!
You have completed (UPI) Chapter 8: Functions and Control Flow in Python!
Instruction
Using Local and Global Variables Together
Python allows global and local variables to have the same name, which can lead to unexpected program behavior. A function treats a variable edited within the function as a local variable unless told otherwise. To edit a global variable inside a function, the variable must be declared with the global
keyword.
Checkpoint: Global and Local Variables in a Program with a Function
<iframe...