Loading Events

« All Events

  • This event has passed.

Python Loop

May 14 @ 8:00 am - 5:00 pm

Loops in Python

In programming, loops are used to execute a block of code repeatedly. Python supports two main types of loops: for loops and while loops.

  1. For Loop:
    • The for loop in Python is used to iterate over a sequence (such as a list, tuple, string, or range).
    • It executes a block of code for each item in the sequence.
      • for item in sequence:
        # Code block to be executed
      • Example
      • for i in range(1, 6):
        print(i)
  2. While Loop:
    • The while loop in Python is used to execute a block of code as long as a condition is true.
    • It repeatedly executes the code block until the condition becomes false.
      • while condition:
        # Code block to be executed
      • Example
      • i = 1
        while i <= 5:
        print(i)
        i += 1
  1. Nested Loops:
    • In Python, you can also have loops inside other loops, known as nested loops.
    • They are used to execute a loop within another loop.
      • Example
      • for i in range(1, 4):
        for j in range(1, 4):
        print(i, j)

Details

Date:
May 14
Time:
8:00 am - 5:00 pm

Organizer

cocas

Venue

RevivingIndia
Meena bazar
Patna, 800007 India
+ Google Map
Phone
9716817710
View Venue Website