Lesson 4.7 · Trace it
Trace: param scope
Python code6 rows to fill2 marks
Complete the trace table for this Python code. [2]
Line 1: def double(n):Line 2, indented 1 level: n = n * 2Line 3, indented 1 level: return nLine 4:Line 5: value = 3Line 6: result = double(value)Line 7: print(value)Line 8: print(result)
Fill in one row each time a line changes value, n or result, 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 | value | n | result | output |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 | ||||
| 6 |