Python Control Flow: Conditions and Loops

Python for Data Science 150 views Nov 14, 2025 1 min read

Conditional Statements

Python supports if, elif, and else conditions.

x = 20
if x > 10:
    print("Greater")
elif x == 10:
    print("Equal")
else:
    print("Smaller")

Loops

For Loop

for i in range(1, 6):
    print(i)

While Loop

count = 0
while count < 3:
    print("Hello")
    count += 1

Break and Continue

for i in range(5):
    if i == 3:
        break
    print(i)

Applications in Data Science

  • Iterating through datasets
  • Conditional filtering
  • Repeated operations
Some advanced sections are available for Registered Members
Share this Post
🚀 Want to Test Your Knowledge?

Take quizzes related to this topic and see where you stand!

Start Quiz Now
Back to Tutorials