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.
A cubed number is a number multiplied by itself three times. 1 cubed is 1 times 1 times 1, which is 1. 2 cubed is 2 times 2 times 2, which is 8. So the cubed number sequence starts:
1
8
27
64
125
You are going to write a program that prints as much of that sequence as the user asks for.
print, exactly as written:
How many cubed numbers would you like?
Read the answer with a bare input() and wrap it in int() so that it is a
number rather than text.
1.while loop that keeps going while the counter has not passed the
amount the user asked for.The counter does double duty here: it counts the repetitions, and it is also the number being cubed each time round. There is no operator for this in the part of Python you have met so far, so work the cube out by multiplying the counter by itself three times.
The question is printed first, exactly as written above. Then one cubed number per line, and nothing else: no sentences, no blank lines, and no finishing message.
If the user asks for 0 numbers, or for a negative amount, the condition is false before the first repetition, so the loop body never runs and the only output is the question. Your program does not need to treat that as a special case: a loop written correctly already does the right thing.
Input:
5
Output:
How many cubed numbers would you like?
1
8
27
64
125
Input:
3
Output:
How many cubed numbers would you like?
1
8
27
Input:
1
Output:
How many cubed numbers would you like?
1
Input:
0
Output:
How many cubed numbers would you like?
The loop body never runs, so the question is the only line the program prints.
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
How many cubed numbers would you like?, 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.input is wrapped in int(), or the counter is compared as text.