Automation and Artificial Intelligence
A script calls a function to normalize an interface status but does not assign its return value. What does it print? ```python status = "down" def normalize(status): status = status.upper() return status normalize(status) print(status) ```
Show the answer
Correct answerD. down
AWhy not this: upper() produces a new string, and assigning it to the local parameter does not update the outer variable.
BWhy not this: The function returns a string, and ignoring that return value does not replace the outer variable with None.
CWhy not this: The parameter already has a value when the function starts, so reading it before the local assignment is valid.
DWhy this is right: The function only rebinds its local parameter; the outer status remains unchanged.
The assignment inside normalize rebinds its local parameter to a new string. The caller ignores the returned string, leaving the outer status equal to "down". Returning a value does not automatically assign it to the caller's variable.