We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is called "list comprehension" -- an awesome way to create lists. He takes only "marks" for every (name, marks) in marksheet, where marksheet is a nested list.
Nested Lists
You are viewing a single comment's thread. Return to all comments →
This is called "list comprehension" -- an awesome way to create lists. He takes only "marks" for every (name, marks) in marksheet, where marksheet is a nested list.
Example:
In [682]: marksheet
Out[682]:
[['Harry', 37.21],
['Berry', 37.21],
['Tina', 37.2],
['Akriti', 41.0],
['Harsh', 39.0]]
In [683]: [marks for name, marks in marksheet]
Out[683]: [37.21, 37.21, 37.2, 41.0, 39.0]