0

Control Flow<<Time’s Up

Sorry, but I can't reach the result. Task:# take the number as input number = int(input()) #use a while loop for the countdown My version: while number>0: print(number) number=number-1 Where is the error?

2nd Jul 2024, 10:36 PM
Natia Koberidze
Natia Koberidze - avatar
3 Respuestas
+ 1
# Hi Natia Koberidze, # If you want to reach zero in your countdown here are some tips: # Decrease the value of 'number' by 1, which is elegantly done in Python with: # number -= 1 number = 5 while number >= 0: print(number) number -= 1 # Another way is to use a for loop like this: n = 5 for i in range(n, -1, -1): print(i)
3rd Jul 2024, 7:11 AM
Per Bratthammar
Per Bratthammar - avatar
0
I can't see any errors. What should happen?
3rd Jul 2024, 12:25 AM
Stefanoo
Stefanoo - avatar
0
Thanks to all of you so much! The correct answer is: number >=0: As far as I am studying PY from this app, there was no mention of >= before this task. Thus, tour help is priceless! 🧡
3rd Jul 2024, 10:33 AM
Natia Koberidze
Natia Koberidze - avatar