Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.

Well done!

You have completed (UPI) Chapter 11: Mastering List Operations, Iteration, and Comprehensions!

Instruction

List Comprehensions

A list comprehension is a Python statement to compactly create a new list using a pattern.

The general form of a list comprehension statement is shown below:

list_name = [expression for loop_variable in iterable]
  • list_name refers to the name of a new list, which can be anything.
  • for is the for loop keyword.
  • An expression defines what will become p...