Answer to Question #303873 in Python for Suresh

Question #303873

Pyramids Frequency

These are N pyramids in a line.You are given their heights as space-separated integers.Write a program to print the heights of the pyramids in increasing order along with their frequency.


Input

The first line of input contains space-separated integers.


Output

Each line of output should contain the height of the pyramid and its frequency in the ascending order of the pyramid's height.


Explanation

In the example, The given pyramid heights are 1,5,1,2,5,6.

The frequency of each unique pyramid height is

1 2

2 1

5 2

6 1


Sample Input1

1 5 1 2 5 6

Sample Output1

1 2

2 1

5 2

6 1



1
Expert's answer
2022-02-28T08:30:10-0500
nums = [int(num) for num in input().split()]
for num in set(nums):
	print(num, nums.count(num))

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