Set and dictionary comprehensions PREMIUM

Topic Series: Comprehensions

Trey Hunner smiling in a t-shirt against a yellow wall
Trey Hunner
4 minute read Works on Python 3.7—3.10
Python Morsels
Watch as video
03:19

In addition to list comprehensions, we also have set and dictionary comprehensions in Python.

Making a set with a for loop

We have a [multi-line](https://docs.python.org/3/tutorial/introd...

Write more Pythonic code

Need to fill-in gaps in your Python skills? I send regular emails designed to do just that.

Python Morsels
Watch as video
03:19