filter and map with two lambda functions on a list of codes.
codes = ["a1", "B2", "c3", "D4"]
nums = list(map(lambda c: int(c[1]), filter(lambda c: c[0].isupper(), codes)))
print(nums, sum(nums))
What does the program print?Log in to join the discussion.
Loading…