Python3 PAT (Basic Level) 【乙级】 - 1021 个位数统计

tech2022-09-06  108

原题链接

count = [0,0,0,0,0,0,0,0,0,0] #预备好0~9计数列表 n=int(input()) for i in str(n): #遍历字符串 并进行计数 count[int(i)]+=1 for i in range(10): if count[i]!=0: print(str(i)+":"+str(count[i]))
最新回复(0)