大家都来帮我看看这个啊,我不会了

img

s=input()
l=s.split(' ')
print(l)
d={}
for i in l:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
klist = sorted(d)
for i in klist:
    print(i+':'+str(d[i]))

觉得有用的话采纳一下哈

words = "New to Python or choosing between Python 2 and Python 3 Read Python 2 or Python 3"
words = words.split(' ')
def word_nums(word, words):
    count = 0
    for i in words:
        if word == i:
            count += 1
    return count
python = 'python'
for word in words:
    print('%s: %d'%(word, word_nums(python, words)))

有用请采纳,谢谢!!!

from collections import Counter
import wordninja

str = input()
splited_words=wordninja.split(str.lower())
count = Counter(splited_words)
print(count)