Advertisement
Mofeoluwa

CountOfA

Feb 29th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. def count_of_a(list1):
  2.     x = []
  3.     for i in list1: #loop through the elements in list1
  4.         if 'a' in i: #if a in any element in list1
  5.             sage = i.count('a') #count the number of a in that element
  6.             x.append(sage) #add the count to x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement