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

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

1 Expert Approved Answer
Step: 1 Unlock

First lets analyze the code python a 10 b 20 c 30 def sub1 global ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Operating System Questions!