get most common element in list python
from collections import Counter
listOfArtists = [
'Linkin Park',
'Lil Peep',
'Lil Peep',
'Cold Hart',
'Team Astro',
'Tom Odell',
'Bazzi',
'The Weeknd',
'Juice WRLD',
'The Weeknd',
'Foster The People',
'Linkin Park',
'Linkin Park',
'Lil Peep',]
amount = 4
print(Counter(listOfArtists).most_common(amount)) # amount = elements returned
#output: [('Linkin Park', 3), ('Lil Peep', 3), ('The Weeknd', 2), ('Cold Hart', 1)]