Articles → PYTHON → Break And Continue Statement In Python

Break And Continue Statement In Python






Break Statement




message = "This is the test message"

for character in message:
  if character == " ":
   break
  else :
   print("The value is ", character)




  1. Loop through all the characters in the string ‘This is the test message’
  2. If the blank space is found, then exit the loop


Picture showing the output of break statement in python
Click to Enlarge




Continue Statement




message = "This is the test message"

for character in message:
  if character == " ":
   continue
  else :
   print("The value is ", character)




Picture showing the output of continue statement in python
Click to Enlarge




Posted By  -  Karan Gupta
 
Posted On  -  Monday, February 18, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250