List comprehension in Python is a compact way to create new lists by transforming or filtering items from an existing one. It lets you write in one readable line what would normally take several lines of a loop.
A list comprehension looks like this:

Simple Example

Adding a Condition
You can filter items using an if clause:

This creates a list of only the numbers that satisfy the condition.
Same thing using a for loop:

Nested Loops with List Comprehension
You can also nested loops:

Quick Summary
List comprehension is a concise way to build lists using a loop, optional filtering, and an expression.
Web developers love it because it is short and clean. It removes unnecessary loops and reads easily like a sentence.