Question: (20pt) Consider the two Python programs below: def A(I, P): def A(I, P): def B(): def B(): print(I) print(I) if I > 3: if I


(20pt) Consider the two Python programs below: def A(I, P): def A(I, P): def B(): def B(): print(I) print(I) if I > 3: if I > 3: PO) PO) elif I > 2: elif I > 2: A(4, B) A(4, P) elif I > 1: elif I > 1 : A(3, B) A(3, P) else: else: A(2, B) def C(): def C(): pass pass A(1, 0) A(1, C) A(2, B) (1) (1pt) Find the differences between the two programs. (2) (1pt) Find the output of each program. (3) (18pt) Explain the difference. (Python is using static scoping and dynamic binding.) Hint: Insert a print(I, P, B) statement as the very beginning of the code of A(I, P) to monitor what is going on
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
