Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
lfa:lab01-python-intro [2021/10/06 11:39] claudiu.dorobantu [Slicing lists] |
lfa:lab01-python-intro [2021/10/07 11:32] (current) ioana.georgescu [List comprehensions] |
||
---|---|---|---|
Line 197: | Line 197: | ||
| | ||
# computing the average ages (a map could have also been used) | # computing the average ages (a map could have also been used) | ||
- | avg = reduce(lambda a,b:a+b, [age(x) for x in l]) / len(l) | + | avg = reduce(lambda a,b:a+b, [age(x[-1]) for x in l]) / len(l) |
| | ||
# we return the last name and the age of the filtered list l | # we return the last name and the age of the filtered list l |