Question: 8. (10 points) Given this Python-like code which uses static scoping, which will be printed out when the code runs? If error, indicate where
8. (10 points) Given this Python-like code which uses static scoping, which will be printed out when the code runs? If error, indicate where the error(s) is/are. a=10 b=20 c=30 def sub1(): global c def sub2(): b=c+2 print(a, b, c) a = b+5 Your answer here 1st call print (a, b, c) in sub1: -- 2nd call print(a, b, c) in sub2: -- 3rd call print(a, b, c) in main: C = 15 print(a, b, c) sub2() sub1() print (a,b, c)
Step by Step Solution
3.48 Rating (148 Votes )
There are 3 Steps involved in it
First lets analyze the code python a 10 b 20 c 30 def sub1 global ... View full answer
Get step-by-step solutions from verified subject matter experts
