Lesson 4.4 · Trace it
Trace: return value
Python code4 rows to fill2 marks
Complete the trace table for this Python code. [2]
Line 1: def add_one(x):Line 2, indented 1 level: return x + 1Line 3:Line 4: a = 3Line 5: b = add_one(a)Line 6: c = add_one(b)Line 7: print(c)
Fill in one row each time a line changes a, b or c, or prints something. The table already has the right number of rows. In each row, write only what that line changes; you can leave the other cells empty or copy their values down. Write values the way Python shows them: 3 and 3.0 are different, and text goes in quotes. In the output column, write exactly what appears on screen, with no quotes around it.
| Row | a | b | c | output |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 |