Histogram | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Histogram

Write a Python function histogram(l) that takes as input a list of integers with repetitions and returns a list of pairs as follows: for each number n that appears in l, there should be exactly one pair (n,r) in the list returned by the function, where r is is the number of repetitions of n in l. the final list should be sorted in ascending order by r, the number of repetitions. For numbers that occur with the same number of repetitions, arrange the pairs in ascending order of the value of the number.

9th Mar 2018, 1:43 AM
SUNIL PATIL
SUNIL PATIL - avatar
1 Answer
0
you could just use matplotlib
11th Aug 2018, 8:36 PM
Dave David
Dave David - avatar