Мой профиль
ACTIVITY 20 / 50

Charge the robot

Try as many times as you need

Let’s understand

A loop can move a value towards a target. It checks the condition before every repetition. If the condition is false at the start, the block never runs. After the loop, execution continues at the next unindented line.

Listen to the explanation

Example

n = 2
while n < 4:
    n += 1
print(n)
YOUR MISSION

Read a charge from 0 to 10. Add 1 while it is below 10. Print it after the loop.

I need a hint

Place print after the loop, without indentation.

How to find an error
  1. Read the last line of the error message.
  2. Find the indicated line. Check quotes, parentheses and indentation.
  3. Change one thing and run again.

main.py

4 spaces

Your draft stays in this browser.

Result

Python
Your program’s output will appear here. Click Run.