Jan-06-2023, 06:43 AM
Personally, I'd break the problem down into steps: turn the list of people into just a list of ages (which is a
The third party Tools library has functions that can make these sorts of pipelines read quite nicely: https://toolz.readthedocs.io/en/latest/a...read_first.
map
or list comprehension) and then add those up (the reduce
).The third party Tools library has functions that can make these sorts of pipelines read quite nicely: https://toolz.readthedocs.io/en/latest/a...read_first.