What are the must know features of python programming languageThe Tara Nights

List comprehensions

One of the major features of python is list comprehension. It is a natural way of creating a new list where each element is the result of some operations applied to each member of another sequence of an iterable. The construct of a list comprehension is such that it consists of brackets containing an expression followed by a for clause then by zero or more for or if clause. List comprehensions always returns a list.

Simple example

squares = [x**2 for x in range(10)]

In a…

Read the entire article at the source link…

#codango #developer #development #coder #coding

We're happy to share this resource that we found. The content displayed on this page is property of it's original author and/or their organization.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*