Graphical Python | Break Statement

Graphical python | break statement

In Python, the break statement breaks the smallest enclosing for or while loop, will stop the execution of the deepest loop, and start executing the next line of code.

Python-break statement

Python break statement, which breaks the smallest enclosing for or while loop.
The break statement is used to terminate the loop statement, that is, the loop condition has no False condition or the sequence has not been fully recursed, and the execution of the loop statement will also be stopped.
In a nested loop, the break statement will stop the execution of the deepest loop and start executing the next line of code.
Python language break statement syntax:
break
flow chart:
Here is the code sample (the code can be run in an online python3 environment ):
for letter in ' ItIsShowMeAI ' : # first instance
if letter == 'h' :
break
print( 'Current letter:' , letter)

var = 10 # second instance
while var > 0 :
print( 'Current variable value:' , var)
var = var -1

Graphical python | break statement.Data and code download


The code of this tutorial series can be downloaded from the corresponding github of ShowMeAI and can be run in the local python environment. Babies who can access Google can also use google colab to run and learn interactively with one click!
The Python cheat sheets covered in this tutorial series can be downloaded from:
•Python cheat sheet
Extended References
•Python Tutorial —Python3 Documentation
•Python Tutorial - Liao Xuefeng 's official website
Recommended articles related to ShowMeAI
•Introduction to python
•python installation and environment configuration
•python basic syntax
•python basic data types
•python operator
•python conditional control and if statement
•python loop statement
•python while loop
•python for loop
•python break statement
•python continue statement
•python pass statement
•python strings and operations
•python list
•python tuple
•python dictionary
•python collections
•python function
•python iterators vs generators
•python data structure
•python module
•python file read and write
•python file and directory operations
•python error and exception handling
•object oriented programming in python
•python namespace and scope
•python time and date
ShowMeAI series tutorial recommendation
•Graphical Python Programming: From Beginner to Mastery series of tutorials
•Graphical Data Analysis: From Beginner to Mastery Tutorial Series
•Illustrated Big Data Technologies: From Beginner to Mastery Series
•Illustrated Machine Learning Algorithms: From Beginner to Mastery Tutorial Series
•Machine learning combat: teach you how to play machine learning series
•Deep learning tutorial | Wu Enda special course · full set of notes interpretation

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00