Skip to content

Comprehensions

Comprehension is a unique feature of Python. Comprehension gives us a concise way to construct sequences like lists, sets, and dictionaries. Using comprehension we can create Python sequences with complex functionality using just one line of code.

There are four types of comprehensions in Python.They are:

  • List Comprehension
  • Dictionary Comprehension
  • Set Comprehension
  • Generator Comprehension