...

/

List Comprehension

List Comprehension

Now that we are done with lists, let's have a look at list comprehension.

We'll cover the following...

List Comprehensions

List comprehensions are a concise way to create lists. They consist of square brackets containing an expression followed by the for keyword; the result will be a list whose results match the expression.

The general syntax is:

In python, here’s how to create a list with the squared ...