Write a program that reads some integers between 1 to 100 and counts the occurance of each.
nums_count = {}
inp = input()
while inp:
num = int(inp)
if num in nums_count:
nums_count[num] += 1
else:
nums_count[num] = 1
inp = input()
for num, occurance in nums_count.items():
print(f'{num}: {occurance}')
Comments
Leave a comment