Comprehensions

Comprehensions#

Learning Objectives#

After working through this topic, you should be able to:

  • Write list comprehensions and dict comprehensions

  • Explain why comprehensions are not enough for numerical code even though they are faster than loops

  • Discuss when to use list comprehensions and for loops

Materials#

Video:

Download the slides.