0

Please guys... Help me with this code on while loop ... Input is 3 and 5, should countdown to zero... Bt still failed response

# take the number as input number = int(input()) #use a while loop for the countdown Timer = 5 while Timer > -1 : print(Timer) Timer = Timer - 1

6th Nov 2023, 12:20 AM
CHRISTIAN
CHRISTIAN - avatar
2 Antworten
+ 5
If I understand your question right, you want to make counter to count to 0 from the given number. If that is the case then you should use 'number' variable instead of 'Timer' like this number = int(input()) while number >= 0: print(number) number -= 1
6th Nov 2023, 1:06 AM
Dejan Francuz🥇
Dejan Francuz🥇 - avatar
+ 3
CHRISTIAN , Dejan Francuz🥇 already gave the answer, but I want to give you a tip about naming new variables. They should be lower case, like timer, not Timer. Later, when we start naming classes, we use capitalized nouns, like Timer. Conventions make it easier for everyone when reading each others' code. Search "Python PEP 8" for more info about naming conventions and formatting conventions.
6th Nov 2023, 5:57 PM
Rain
Rain - avatar