Question: What is the code output below? The code (python) is using static scoping. (5 pts) Note: Do NOT run the code, also pay attention
What is the code output below? The code (python) is using static scoping. (5 pts) Note: Do NOT run the code, also pay attention to the indentations. The vertical bar is here to help you identify the indentations. def big(): def sub1(): x = 7 print("In sub1, x is", x) sub2() X=X+1 print("before finish sub1, x is", x); def sub2(): nonlocal x y=x X = x + 1 print("In sub2, x is", x) print("In sub2, y is", y) x=3 sub1() print("in big, x is", x) big()
Step by Step Solution
There are 3 Steps involved in it
Given the Python code in the image and the statement that it uses static scoping we need to determine the output of the code without running it In Pyt... View full answer
Get step-by-step solutions from verified subject matter experts
