Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 18 Online
OpenStudy (anonymous):

OK next one, why, in the loop num = 5 if num > 2: print(num) num -= 1 print(num) does it only print out 5,4 (and not 3) ?

OpenStudy (microbot):

because there is no iteration. u say that num=5 ... then u control if 5>2 (it is)... u do the if block where u print the num that is currently 5 and then u make num-1...that is 4. u exit the if statement and print the new num that is 4. then your done. no iteration

OpenStudy (anonymous):

OK, so no 'while' to iterate through, me not paying attention

OpenStudy (microbot):

hahah dw at start when i saw this i thought dont know why there was a while loop xD...then i saw...:OOOxD

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!