GH avatar Bite 278. Major and minor numbers

You are given a list of integers. Write code to find the majority and minorty numbers in that list.

Definition: a majority number is the one appearing most frequently, a minority number appears least frequently.

Here is a simple example how it should work:

>>> numbers = [1, 2, 2, 3, 2, 3]
>>> major_n_minor(numbers)
(2, 1)

Note - you can assume that there will be only one of each.

Hint: any built-in library that supports convenient and rapid tallies?

Login and get coding
go back Beginner level
Bitecoin 2X

34 out of 36 users completed this Bite.
Will you be Pythonista #35 to crack this Bite?
Resolution time: ~25 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 4.33 on a 1-10 difficulty scale.
» Up for a challenge? 💪

We use Python 3.8