+ 1
Python loops
Please can some help me with this I’ve been stuck on this Create a timer program that will take the number of seconds as input, and countdown to 0. My code: #• take• the number as • input number = int (input ()) #use a while loop for the countdown number= • while number >0: • •print(• number-1) • • number= number-1 I know there is a problem with my 4th row of code but I don’t know what it is. It’s supposed to work of any input variable because it’s those practice questions. Please 🙏🏾
2 Respostas
+ 4
Use tab to keep equal whitespace
+ 4
Sanelisiwe Ndlovu, you have an extra whitespace
When indenting, try to follow the block correctly
num = int(input())
while num >= 0: # creating a block of the while loop.
while num >= 0:
print(num)
num = num -1
keep your indentations correct. If you indent 4 whitespaces to begin with, then your next indentation is the same 4 whitespaces.
https://sololearn.com/compiler-playground/cWthExZYN602/?ref=app