Python break statement
Can you show me an example of using break statement in Python and purpose of this statement.
By : Amali Email : amali20@gmail.com
Date/time : 2021-09-23

ID 1
Name Sisira Palihakkara
Email sisiraedck@gmail.com
Answer break Statement
• break statement in Python terminates the current loop and resumes execution at the next statement.
• The break statement can be used in both while and for loops.
Date/Time 2021-09-23

ID 2
Name Sisira Palihakkara
Email sisiraedck@gmail.com
Answer
n,t=1,0
while n<10:
    t+=n
    print(t)
    if t>15: break
    n+=1
print(‘End..’)
Date/Time 2021-09-23

Name
Email
Answer
User Code