0
While loop issue on Sublime
Hi everyone, I installed Python 3.6 and using Sublime Text 3 as IDE and build platform. When I run this example: x = 5 while (x <= 5): print(x) x+=1 Result is: 5 [Finished in 0.1s] It should print the numbers from 1 to 5. What could be the problem? Regards.
2 Antworten
+ 1
There is no problem, the result is effectively 5.
It you want to output numbers from 1 to 5, you have to initialize x to 1, not 5 ;)
+ 1
Dear Corentin,
Thanks for your reply. It is really funny when you make this kind of typo and wait for the code run as you wish :)
Cheers!