DEV Community

Cover image for Day 6 of My Data Analytics Learning Journey!
Ramya .C
Ramya .C

Posted on

Day 6 of My Data Analytics Learning Journey!

Hi connections!
Today at Payilagam Institute, I explored an important programming concept in Python — Flow Control Statements. These help control the direction and logic of a program.

What I Learned: Flow Control Types in Python

  1. Conditional Statements
  2. Used to make decisions based on conditions.
    Example: if, elif, else

  3. Looping Statements

  4. Used to repeat a block of code multiple times.
    Example: for, while

  5. Control Statements

  6. Modify the flow of loops.
    Example: break, continue, pass

  7. Exception Handling

  8. Used to handle errors without crashing the program.
    Example: try, except, finally

  9. Pass Statement

  10. Acts as a placeholder when no action is required.
    Example: pass

Example Program (All in One):
x = 10

1. Conditional Statement

if x > 5:
print("x is greater than 5")

2. Looping Statement

for i in range(4):
if i == 2:
continue # 3. Control Statement (continue)
print("Loop value:", i)

4. Exception Handling

try:
result = x / 0
except ZeroDivisionError:
print("Cannot divide by zero")
finally:
print("This always runs")

5. Pass Statement

def future_feature():
pass

print("Program executed successfully!")

Python #DataAnalytics #LearningJourney #Payilagam #SlowLearnerStrongFuture

Top comments (0)