Why does this code have 4 numbers in output rather than 5...where does -1 in output go? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does this code have 4 numbers in output rather than 5...where does -1 in output go?

Why does this code have 4 numbers in output rather than 5...where does -1 in output go? https://code.sololearn.com/cz5w4zHWT91V/?ref=app

11th Jul 2021, 6:28 PM
Kim254
Kim254 - avatar
1 Answer
+ 2
See how loop working your values are decreasing continuously from 3 2 1 0 When u reached at 0 here While0>=0 its true so last valuw 0 will print then it will decrease while i>=0: print (i) i=i-1 //0-0 which is -1 But when condition will check in while Like while -1>0 its false that's why its not printing
11th Jul 2021, 6:37 PM
A S Raghuvanshi
A S Raghuvanshi - avatar