Advertisement
OsahonE

Wk5_3

Apr 1st, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def count_of_a(list):
  2.     counts = []
  3.    
  4.     #iterating through the list and counting the number of "a" in each string, then appending to the counts list, we have:
  5.        
  6.     for strings in list:
  7.         counts.append(strings.count("a"))
  8.     return counts
  9.    
  10. print(count_of_a(["alligator", "aardvark", "albatross"]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement