Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def count_of_a(list):
- counts = []
- #iterating through the list and counting the number of "a" in each string, then appending to the counts list, we have:
- for strings in list:
- counts.append(strings.count("a"))
- return counts
- print(count_of_a(["alligator", "aardvark", "albatross"]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement