Answer to Question #255614 in Python for hari

Question #255614

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


1
Expert's answer
2021-10-23T13:53:46-0400
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]))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS