Prepared by:
Jahanara Taznina Orin
For loop: The for loop iterates over a given sequence (it may be a list, tuple, or string). itself
allows for this.
Syntax of for Loop
for val in sequence:
Body of for
break statement: With the break statement
we can stop the loop even if it is true.
While loop: With the while loop we can execute a set of statements as long as a condition is
true. It requires to define an indexing variable.
Syntax of while Loop in Python
while test_expression:
Body of while
break statement: With the break statement
we can stop the loop even if it is true.
CH-7: Control-flow-in-python-programming-language.pptx
CH-7: Control-flow-in-python-programming-language.pptx
CH-7: Control-flow-in-python-programming-language.pptx
CH-7: Control-flow-in-python-programming-language.pptx
CH-7: Control-flow-in-python-programming-language.pptx
CH-7: Control-flow-in-python-programming-language.pptx
CH-7: Control-flow-in-python-programming-language.pptx
CH-7: Control-flow-in-python-programming-language.pptx
CH-7: Control-flow-in-python-programming-language.pptx

CH-7: Control-flow-in-python-programming-language.pptx

  • 1.
  • 4.
    For loop: Thefor loop iterates over a given sequence (it may be a list, tuple, or string). itself allows for this. Syntax of for Loop for val in sequence: Body of for
  • 17.
    break statement: Withthe break statement we can stop the loop even if it is true.
  • 18.
    While loop: Withthe while loop we can execute a set of statements as long as a condition is true. It requires to define an indexing variable. Syntax of while Loop in Python while test_expression: Body of while
  • 25.
    break statement: Withthe break statement we can stop the loop even if it is true.