想知道到底是哪里错了,咋运行不了
(Python:已知字符串str ,统计每个字母出现的次数)
已结题
想知道是哪里错了(Python:已知字符串str ,统计每个字母出现的次数)
图片转代码服务由CSDN问答提供 功能建议
str-' hnustnicandcomputer or "license" for more in
dictl=0 Traceback (most recent call last):l RESTART: C:\Users \healer\Desktop118.py
for iin str: File 'C:\Users \healer\Desktop\18.py",line1in<module)
ifi in str: dictlLiJ=dictilil+1
dictllij+=1 KeyError:h'
else:
Traceback dictilil=1 RESTART: C:\Users \healer\Desktop\18.py
print(dicti) (most recent call last): File "C:lUsers \healer\Desktop118.py,line1in<module>
dictlliJ=dictilil+1
KeyError:
h
Ph:
1 t':l,#:1,"c"l
Traceback (most recent call last): RESTART: C:\Users Vhealer\Desktop118.py
dictlLil+=l
- 写回答
- 好问题 提建议
- 追加酬金
- 关注问题
- 分享
- 邀请回答