Coursera Learner working on a presentation with Coursera logo and
Coursera Learner working on a presentation with Coursera logo and

Rundown understandings are utilized for making new records from different iterables. 

As rundown understanding returns records, they comprise sections containing the articulation, which is executed for every component alongside the circle to repeat over every component. 

This is the essential sentence structure:

new_list = [expression for_loop_one_or_more conditions]

For example, find the squares of a number using the for loop:

Finding squares using list comprehensions:

Here, square sections mean that the yield is a rundown. n**2 is the articulation executed for every component and for n in numbers is utilized to repeat over every component. At the end of the day, execute n**2 (articulation) for every component in numbers. 

A progressively unpredictable case of rundown appreciation: 

Discover normal numbers from two records utilizing a for circle. 

Find common numbers from two list using list comprehension:

Return numbers from the list which are not equal as a tuple:

Here  as we are restoring a rundown of tuples, tuples must be in the bracket to avoid mistakes. In the above model, tuples with an and b will be printed to such an extent that an and b are not the equivalent. 

Rundown perceptions can likewise be utilized to repeat over strings, as demonstrated as follows:

This model changes  every one of the strings from list_a to the  lower  case. 

Like tuples, list appreciations can be utilized to create a rundown of a rundown, as demonstrated by the following:


Weekly newsletter

No spam. Just the latest releases and tips, interesting articles, and exclusive interviews in your inbox every week.