About 72,100 results
Open links in new tab
  1. Python - List Comprehension - W3Schools.com

    List comprehension offers a shorter syntax when you want to create a new list based on the values of an existing list. Example: Based on a list of fruits, you want a new list, containing only the fruits with the …

  2. List Comprehension in Python - GeeksforGeeks

    Mar 12, 2026 · List comprehension is a concise way to create new lists by applying an expression to each item in an existing iterable (like a list, tuple or range). It helps you write clean, readable and …

  3. Python List Comprehension: Tutorial With Examples

    Dec 30, 2025 · We’ll first look at the most well-known type: list comprehensions. Once we’ve got a good grasp of how they work, you’ll also learn about set comprehensions and dictionary comprehensions.

  4. When to Use a List Comprehension in Python

    Python list comprehensions help you to create lists while performing sophisticated filtering, mapping, and conditional logic on their members. In this tutorial, you'll learn when to use a list comprehension …

  5. Python List Comprehension (With Examples) - Programiz

    List comprehension offers a concise way to create a new list based on the values of an iterable. In this article, we will learn about Python list comprehensions with the help of examples.

  6. 5. Data Structures — Python 3.10.20 documentation

    Mar 10, 2020 · A list comprehension consists of brackets containing an expression followed by a for clause, then zero or more for or if clauses. The result will be a new list resulting from evaluating the …

  7. List Comprehensions in Python: Complete Guide with Examples ...

    5 days ago · Master Python list comprehensions with practical examples. Learn syntax, nested loops, filtering, and performance tips for cleaner, faster code.