I have a str and a list of str and wanted to count the number of times that list occurs in the str. How can i solve this??
I've tried this:
def count_from_word_list(s,l):
"""(str,list of str) -> int
Return the total number of times l appears in the s
"""
counter = 0
for item in s.split():
for item in l:
if s == l:
counter= counter + 1
return counter