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.

4th Mar 2018, 4:41 AM
darshan ks
darshan ks - avatar
4 Answers
+ 7
Please submit challenges via the lesson-factory. Thanks.
4th Mar 2018, 4:44 AM
Fox
Fox - avatar
+ 6
On the main-menu of the app, click the 3 dots in the corner. Select "Lesson Factory". Post your challenges there, not here.
4th Mar 2018, 4:48 AM
Fox
Fox - avatar
0
What?
4th Mar 2018, 4:45 AM
darshan ks
darshan ks - avatar
- 1
Ty
4th Mar 2018, 4:49 AM
darshan ks
darshan ks - avatar