CS 220 - Tracing Functions

Worksheet Problem 19

Python 3.6
1print("A")
2
3def foo():
4   print("B")
5print("C")
6foo()
7print("D")
8foo()
line that has just executed

next line to execute

Print output (drag lower right corner to resize)
Frames
Objects

Worksheet Problem 20

Python 3.6
1print("A")
2
3def foo():
4   print("B")
5   print("C")
6foo()
7print("D")
8foo()
line that has just executed

next line to execute

Print output (drag lower right corner to resize)
Frames
Objects

Worksheet Problem 21

Python 3.6
1def func_c():
2   print("C")
3
4def func_b():
5   print("B1")
6   func_c()
7   print("B2")
8
9def func_a():
10   print("A1")
11   func_b()
12   print("A2")
13
14func_a()
line that has just executed

next line to execute

Print output (drag lower right corner to resize)
Frames
Objects

Worksheet Problem 22

Python 3.6
1def f():
2   print("A")
3   return("B")
4   print("C")
5print("D")
6x = f()
7print("E")
8print(x)
line that has just executed

next line to execute

Print output (drag lower right corner to resize)
Frames
Objects