QuestionQ14

Functions, Classes and Objects

When the following question.py program is run with Python, what is the output?

Question Image

Explanation

Calling i(10) enters the function, where the local parameter i is reassigned to 5. The function returns 5, that value is assigned to the outer variable i, and print(i) outputs 5.

Community Discussion

No comments yet. Be the first to start the discussion!