PL 11-12

Subdecks (3)

Cards (37)

  • 2 types of loops in Python:
    for loop
    while loop
  • the for loop is used to run a block of code for a certain number of times.
  • loops are used to repeat a block of code.
  • range is a series of values between two numeric intervals.
  • a for loop inside another for loop, it’s called a nested for loop.
  • The break statement is used to exit the for loop prematurely.
  • We can use continue statements inside a for loop to skip the execution of the for loop body for a specific condition.
  • step parameter - It tells the range function how many numbers to skip between each count.
  • while loop implements the repeated execution of code based on a given Boolean condition.
  • The syntax of while loop
  • The syntax of the for loop
  • We can use else block with a Python for loop.
  • A while loop can have an optional else block as well.
  • str.lower() - a string function to convert the string to all lower-case
  • It is used to iterate over any sequences such as listtuplestring