Easy_Flex

Untitled

Feb 29th, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. def count_of_a(alist):  # function to count number of times "a" occurs in a word in a list
  2.     return list(map(lambda word: word.count("a"), alist))  # use of map and lambda function to iterate through the list
  3.  
  4.  
  5. print(count_of_a(["alligator", "aardvark", "albatross"]))
Add Comment
Please, Sign In to add comment