you are given space- separated integers as input, write a program to print the numbers in the increasing order along with their frequency in python
numbers= list(map(int,input("Enter integers separated by a space: ").split()))
frequencyDictionary = {}
for n in numbers:
if (n in frequencyDictionary):
frequencyDictionary[n] += 1
else:
frequencyDictionary[n] = 1
for key in sorted(frequencyDictionary):
print ("%d : % d"%(key, frequencyDictionary[key]))
Comments
Leave a comment