← BYTES
Python·Starter·Ref: 6.1.5
What is a list comprehension used for?
Have a question about this video? Mention reference 6.1.5 when you contact us.
a.Compressing a list to save memory
b.Creating a new list concisely from an iterable, optionally with a condition
c.Comparing two lists for equality
d.Sorting a list in place
A list comprehension like `[x*2 for x in range(5) if x > 1]` builds a new list from an iterable in a single, readable expression.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES615#Python