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

special_words = ["awesome", "excellent", "amazing", "fun", "beautiful", "great", "cool"] def count_special_word(string, special_words): for word in string: if word in special_words: print(word) count_special_word("amazing", special_words)

Questions about programming?Chat with your personal AI assistant