+ 1
Why does my code show it wrong
Question: write a code that takes a number as input and continues till it reaches 0 # take the number as input num = int(input()) #use a while loop for the countdown while num < 0: print(num) num-=1
3 Answers
+ 4
Mohammed Mahbeer Rahman ,
Comparing operator should be: >= (the `=` is important if the value of 0 should be included in output)
Currently the code runs an infinite loop.
+ 2
Mohammed Mahbeer Rahman ,
The error in your code is the while loop condition.
Instead of `while num < 0`,
use this `while num > 0`.
This will ensure that the loop continues until the value of `num` reaches 0.
+ 1
@<{[ăsandra ă]}>âĄâ
Thank to you for reminding me about the mistake i've done
May you be sucessful in this life