CONTINUE STATEMENT IN PYTHON
This is a simple basic conceptual program on how continue statement works in python. In the code below we can see that from 1 to 50, the numbers that are divisible by both 4 and 5 (i.e. 20 and 40) are not printed. The rest numbers are printed. Remember for the 'and' logical operator both statements must be true. The continue statement is used to skip the rest of the code inside the loop and is used to go back to beginning of the loop to begin the next iteration. That meant to say that continue won't execute the statement whose condition is true.
for i in range(1,50):
if i%4==0 and i%5==0:
continue
print(i)
If you run the above code, you can see the following output:
You can run this code online here.
Leave CONTINUE STATEMENT IN PYTHON to:
Read more #code posts
Best Posts From Leo Umesh
We have not curated any of leoumesh's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Leo Umesh
- The Tattoo of My Newborn Baby Girl Forever Inked on My Skin
- Long Weekend Food Feast With Wife
- String Manipulation in C#: Part 2
- String Manipulation in C#
- Introduction to C# and .NET
- Weekend Escape To Falls
- Evening Barbecue With Favourite Beer 🍺 🍻
- NumPy Broadcasting
- Summer BBQ
- Review of "The Day of The Jackal" Series