0
[ASSIGNMENT] Write a Python function program
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.
4 Answers
+ 7
Please submit challenges via the lesson-factory.
Thanks.
+ 6
On the main-menu of the app, click the 3 dots in the corner. Select "Lesson Factory". Post your challenges there, not here.
0
What?
- 1
Ty