Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Loops – For | Python Fundamentals lesson | BraveProgrammer
  1. Courses
  2. /
  3. Python Fundamentals

Lesson 8 of 55

·Python

Loops – For

20 minutes

Course progress15%

What you'll learn

Keep these ideas in mind as you work through the lesson.

3 points
  • `for item in iterable:` loops over each element.
  • `range(start, stop, step)` generates numeric sequences.
  • `enumerate(iterable, start=0)` provides index/value pairs.

Loops – For

Python’s for loop iterates over any iterable – lists, tuples, strings, ranges, or generators. It abstracts away manual indexing.

# Iterate over a list
fruits = ['apple', 'banana', 'cherry']
for fruit in fruits:
    print(fruit)

# Iterate over a range of numbers
for i in range(3):
    print('i =', i)

If you need both the index and the value, use enumerate():

for idx, fruit in enumerate(fruits, start=1):
    print(idx, fruit)
Make it stickPractice what you've learned1 quiz · 5 practical tests · Optional activities from Python FundamentalsBrowse activities
Previous lessonLoops – WhileContinue to lesson 9FunctionsBack to Python Fundamentals curriculum