

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Loops
incomplete
2: Loops Practice
incomplete
3: Loops Practice
incomplete
4: Loop Review
incomplete
5: Loop Review
incomplete
6: Whitespace in Python
incomplete
7: Range Continued
incomplete
8: Sum Game
incomplete
9: Sum Game 2
incomplete
10: While
incomplete
11: Continue Statement
incomplete
12: Break Statement
incomplete
13: Match Countdown
incomplete
14: Experience Points
incomplete
15: Meditate
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Remember you can use in-place operators to increase or decrease a variable by any amount.
number_of_enemies = 10
number_of_enemies += 2
# number_of_enemies is 12
number_of_enemies = 10
number_of_enemies -= 2
# number_of_enemies is 8
Fix the bug in the sum_of_numbers function. Instead of adding 1 to total at each iteration of the loop, it should add i. For example, instead of:
1 + 1 + 1 + 1 + 1...
we want:
0 + 1 + 2 + 3 + 4...
The desired output is a single number after the loop has finished executing.