Totalling & Counting
Exam code: 2210
Totalling & Counting
Totalling & Counting
How do you use totalling in a program?
Totalling involves adding up values, often in a loop
A total variable is set to 0 at the beginning of the program and then updated within a loop, such as:
Pseudocode | Python |
|---|---|
| |
How do you use counting in a program?
Counting involves keeping track of the number of times a particular event occurs
A count variable is set to 0 and then updated within a loop, such as:
Pseudocode | Python |
|---|---|
| |