Create a program that will take the number of seconds as input and countdown to zero | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Create a program that will take the number of seconds as input and countdown to zero

2nd Nov 2023, 9:19 PM
Emmaculate Moraa
Emmaculate Moraa - avatar
4 Answers
+ 6
in the first line, you get input and store it in the variable <number>. use it for your program – remove the "number = 3" part. at the moment your while-loop goes on infinitely. you are trying to reduce <number> in "number - 1" but you didn't change <number>. you need to write "number = number - 1" to update the value.
2nd Nov 2023, 10:02 PM
Lisa
Lisa - avatar
+ 4
What have you tried so far? Show your code.
2nd Nov 2023, 9:27 PM
Lisa
Lisa - avatar
+ 2
# take the number as input number = int(input()) #use a while loop for the countdown number=3 while number>0: print(number) number-1
2nd Nov 2023, 9:39 PM
Emmaculate Moraa
Emmaculate Moraa - avatar
+ 2
Thanks Ma'am 😊😊
2nd Nov 2023, 10:10 PM
Emmaculate Moraa
Emmaculate Moraa - avatar