[Tutor] While loop
Najam Us Saqib
ausnajm at yahoo.com.au
Sun Apr 7 05:23:57 CEST 2013
Hi,
Would you please help me by explaining that why " 5 " is skipped and not printed in the following program?
Thank you.
Najam.
count = 0
while True:
count += 1
# end loop if count is greater than 10
if count > 10:
break # means "break out of the loop"
# skip 5
if count == 5:
continue # means "Jump back to the top of the looop"
print count
raw_input("\n\nPress the enter key to exit.")
Output:
1
2
3
4
6
7
8
9
10
Press the enter key to exit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130406/0a6281d6/attachment.html>
More information about the Tutor
mailing list