【问题描述】统计英文句子"Time is short,we need Python."中各字符出现的次数。统一转换成小写(.lower@)统计
【输入形式】无输入
【输出形式】
【样例输入】
【样例输出】
{t': 3, i : 2, 'm': 1, 'e':4,' : 4, 's':2, 'h :2, '0':2, 'r': 1, ', :1, 'w': 1 , 'n':2, 'd : 1, 'p': 1, y': 1, ' ':1}
【样例说明】
【评分标准】
l = "Time is short,we need Python."
n = len(l)
counts = {}
m=l.lower()
print(m)
for i in range(0, n):
if m[i] in counts:
counts[m[i]] = counts[m[i]] + 1
else:
counts[m[i]] = 1
counts1 = [(v, k) for v, k in counts.items()]
count={}
for r in range(0, len(counts1)):
count[counts1[r][0]]=counts1[r][1]
print(count)