Important Notice:

Loops in Python

Loops in Python

19 views 1 min read

for Loopfor i in range(1, 6):\n print(i)\n\nfruits = ["apple", "mango", "banana"]\nfor fruit in fruits:\n print(fruit)while Loopi = 1\nwhile i <= 5:\n print(i)\n i += 1Loop Control

  • break: Exit loop
  • continue: Skip iteration
  • pass: Do nothing (placeholder)

Nested Loopsfor i in range(1, 4):\n for j in range(1, 4):\n print(i * j, end=" ")\n print()

Related Notes