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

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Python Fundamentals

Lesson 14 of 55 · Python

List Comprehensions

Duration: 20 minutes

List Comprehensions\n\nList comprehensions provide a concise way to create lists from existing iterables, optionally filtering or applying an expression.\n\npython\n# Squares of numbers 0‑9\nsquares = [x * x for x in range(10)]\nprint(squares)\n\n# Filtering even numbers from 0‑19\nevens = [x for x in range(20) if x % 2 == 0]\nprint(evens)\n\n\nThe general syntax is [expression for item in iterable if condition].\n

Previous: Data Structures – ListsNext: Data Structures – Tuples