Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def count_of_a(alist): # function to count number of times "a" occurs in a word in a list
- return list(map(lambda word: word.count("a"), alist)) # use of map and lambda function to iterate through the list
- print(count_of_a(["alligator", "aardvark", "albatross"]))
Add Comment
Please, Sign In to add comment