求助用字符串方法只有80
查看原帖
求助用字符串方法只有80
749028
QAQ5楼主2024/7/18 17:07
# 从a到b的数字中每个个位数出现的次数统计
Input = input()
two = Input.split(' ')
leftNum = int(two[0])
rightNum = int(two[1])
data = list(range(leftNum,rightNum+1))
total = []
for count in range(0,10):
    total.append(0)
for d in data:
    for count in range(0,10):
        total[count]+=str(d).count(str(count))
for t in total[:-1]:
    print(t,end=' ')
print(total[-1])
2024/7/18 17:07
加载中...