Online worksheet ยท 4 of 4
Reset the total before adding items - Online practice 4
Read the information, then answer the questions. An adult may read the instructions aloud. Show your working where asked.
Read before answering
Sum trace for values = [8,-3,4]. Set total = 0 BEFORE the loop. For each value, do total = total + value exactly once. After the loop, a mean is total / len(values) only if the list is non-empty. Compare a faulty version that resets total to 0 inside every iteration.
Worksheet preview
This exercise is included in the paid course. Full-course fee: GBP 200.00 once. Register and enrol to complete all course exercises and download the course PDFs. Access begins after payment is confirmed.
Already registered? Sign in