Exercise 9 · Chapter: While LoopsOptional+50 XP
Fix the Accumulator
This program should compute the sum of 1+2+3+4+5, but it starts wrong. Fix it!
Expected output:
15
Need a hint?
3 available · costs 5 XP each
python
total = 1
i = 1
while i <= 5:
total = total + i
i = i + 1
print(total)
Output
Run your code to see the output here.