• + 6 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]