Solved

What Happens When a Function Tries to Assign or Change

Question 21

Multiple Choice

What happens when a function tries to assign or change a value of a variable that has been defined at the module level?


A) The function succeeds, because the module variable is considered global in scope.
B) The function succeeds, but the value is appended to the variable.
C) The function fails, and an out of scope error message is raised.
D) Python creates a temporary variable with the same name, and the value of that variable exists only within the scope of the function.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions