+ 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 RĂ©ponses
+ 3
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
+ 3
Use tab to keep equal whitespace