In a make task you use the skills you have learned to create a program from scratch. There is no starter code: you begin with an empty editor.
This one is a rocket launch countdown. The counters you have written so far all counted up. This one counts down, which changes the starting value, the condition and the line that moves the counter, but nothing else.
print, exactly as written:
Where should the countdown start?
Read the answer with a bare input() and wrap it in int() so that it is a
number rather than text.
while loop that keeps going for as long as the counter is greater
than 0.Blast off.The question is printed first, exactly as written above. Then your program prints the counter on a line of its own, once per repetition, from the starting value down to 1. Finally, after the loop, it prints exactly this:
Blast off
Nothing else is printed: no other words, and no blank lines.
The condition is checked before the body runs, every time. So if the user
enters 0, or a negative number, the counter is not greater than 0 to begin with,
the body never runs at all, and the whole output is the Blast off line. Your
program does not need to treat that as a special case: a loop written correctly
already does the right thing.
Input:
5
Output:
Where should the countdown start?
5
4
3
2
1
Blast off
Input:
1
Output:
Where should the countdown start?
1
Blast off
Input:
0
Output:
Where should the countdown start?
Blast off
The question is part of the output that is checked here, so its spelling,
capital letters and punctuation count. Ask it with its own print, exactly
Where should the countdown start?, and read the answer with a bare input()
on the next line, rather than passing the question to input(...).
Make sure that you check for the following things:
while.while line has a condition.while line has a colon (:) at the end.while, and all of
it by the same amount. Never mix tabs and spaces in one file.Blast off is printed once rather than every time round the loop.counter = counter - 1 or the
shorthand counter -= 1. A counter that goes up never reaches 0, so the loop
would never end.input is wrapped in int(), or the counter is compared as text.