Trace it
Trace: p2 b2 weather trace
Python code14 rows to fill4 marks
Complete the trace table for this Python code. A school weather station stores one day's hourly temperatures, in whole degrees Celsius, in temps. This code counts the hours below freezing and finds the lowest reading. Then answer the question below the table. [4]
Line 1: temps = [3, 2, -1, 4, -2, -1]Line 2: below = 0Line 3: lowest = temps[0]Line 4: for t in temps:Line 5, indented 1 level: if t < 0:Line 6, indented 2 levels: below = below + 1Line 7, indented 1 level: if t < lowest:Line 8, indented 2 levels: lowest = t
Fill in one row each time a line changes t, below or lowest. 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.
| Row | t | below | lowest |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 | |||
| 10 | |||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 |