BestPromptFinderBelow is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Create a Python function that takes in a text string and returns a dictionary of words and the number of times each word appears in the text string. ### Input: A quick brown fox jumps over the lazy dog ### Output: def words_count(text): words_dict = {} for word in text.split(' '): if word in words_dict: words_dict[word] += 1 else: words_dict[word] = 1 return words_dict words_dict = words_count("A quick brown fox jumps over the lazy dog") print(words_dict)
Find similar in the app →