酷代码 AI
菜单
全部AI  /  热门  /  AI写代码神器
服务商

now is the time in the past is the time to get down to the now is the time to work hard for the 其中每个单词之间以空格作为区分,要求统计出每个单词出现的次数,并且统计时不包含空格和标点符号python

```python text = "now is the time in the past is the time to get down to the now is the time to work hard for the" words = text.split() word_count = {} for word in words: if word in word_count: word_count[word] += 1 else: word_count[word] = 1 for word, count in word_count.items(): print(f"{word}: {count}") ``` [2024-10-24 15:12:07 | AI写代码神器 | 103点数解答]

相关提问