thecodezone.
The Code Zone
Short steps, at your pace · Free lessons and practice · Member video walkthroughs
Save your next small win.

Checking your account…

03.02 · Loops / Practice · 7 min

Include the final one in the countdown

The countdown reaches two and stops. Which range argument left one out?

Activity 2 of 8 in Loops

All courses

Python 2: Logic, Loops & Functions / 03.02

Practice countdown ranges

Not started

Fix the excluded stop so the loop prints every number from 10 through 1.

More options

Your lesson progress

Walkthrough: not startedPractice: not started

Empty: not started. Yellow: in progress. Green: complete. Marking the whole activity complete does not replace your test results. These circles save in this browser for this pilot.

Rob follows a countdown from 10 through 9 and 8 to the final 1, asking whether one is included.
Rob’s comic strip · Loops

Your task: count down from ten through one

Keep start assigned to 10. Repair the range so the existing print(number) runs for 10, 9, 8 and every remaining whole number down to 1, in order. Do not print 0 and do not add separate print calls to patch the missing value.

Check challenge compares the complete output, starting value, final loop value and the first and last output lines. These fixed-input checks do not prove the syntax used or all inputs. After passing, try start = 3: expect 3, 2 and 1. Restore 10 before checking again.

Build it one step at a time

Prefer learning by typing? Work through short instructions, run the Python code and check each change before continuing. Your guided project saves separately from the challenge below.

The mini-lesson opens in a new tab. Your own code carries forward; each step has a focused check and an optional hint.

Start mini-lesson(opens in a new tab)

3 steps · Saved work · Instant feedback

YOUR TURN

Count down through the final one

Keep start = 10. Fix the range so the loop prints 10 through 1 in descending order, one number per line. Do not print zero or add separate print calls.

Expected output
10
9
8
7
6
5
4
3
2
1

Keep the starting inputs. Print these lines in this order, without extra output.

  • Keep start at 10
  • Finish with number at 1
  • The first line is 10
  • The tenth line is 1

Edit Python, then run it. Check challenge checks your output and the listed Python requirements. Your code saves on this browser after a short pause. Sign in and choose Save account draft to keep it across devices. Word wrap is enabled.

Ready to checkRun the checks to see your results here.

Need a nudge?

The stop is excluded even when counting down

A negative step changes the direction, not the excluded-stop rule. Which stop lets 1 be visited without visiting 0?

Replace your editor code?

Your current work will be replaced. Choose Cancel to keep it.

Ready to try it?

Practice in your browser and see your results.

Progress details

Have a question?

Ask the Code Zone community.

Ask a question in The Code Zone (opens in a new tab)

Continue learning

ONE STEP FORWARD

The stop stays excluded in either direction. Next, learn what else means when it belongs to a loop.