

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
No active XP Potion
Accept a Quest
Login to submit answers
Back
ctrl+,
Next
ctrl+.
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.
Focus Editor
Alt+Shift+]
Next Tab
Alt+Shift+[
Become a member to Submit
Become a member to Run
Become a member to view solution