Cody Bable

Generation

generate functionMon, 03 Jul 2023

check if the word in the string is in the list of the special words to count, if so, add to dictionary along with the number of times it occurred in the string. if the special word is not in the string, return the special word with zero.

def count_words(s, n): # To do return {} count_words("cat bat mat cat bat cat", ["cat", "bat", "mat"])

Questions about programming?Chat with your personal AI assistant