In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to use the python loop control statement break/continue. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Two keywords are provided in Python to control loop statements, namely break and continue
When the condition is established, break will not execute the subsequent code in the loop and will stop the entire loop
When the condition is established, continue will not execute the subsequent code in the loop and will stop the loop
Next, we use two cases to distinguish between the two control statements.
First, use the while loop statement to print a number between 1 and 5. When we loop to 3, we use the continue keyword to jump out of this loop. It should be noted that when the condition is established, continue will not execute the subsequent code. If the condition of the loop is not changed before the continue keyword, then the condition of the loop will not change, resulting in an endless loop.
I = print 1 to 5while I in a loop
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.