我在第 9 行不断收到一个键错误,我终其一生都无法弄清楚。
这是我的代码
numbers = (input("Enter numbers separated by spaces > "))
alist = []
alist = numbers.split()
count = {}
for word in alist:
if word not in alist:
(count[word]) = 1
else:
(count[word]) = (count[word]) + 1
print(count)
for k,v in count.item():
if v == 1:
print(k, "occurs", v, "time")
else:
print(k, "occurs", v, "times")