I am looking to count the total number of duplicates in a list. Then display in alpha/numeric order the name of the list item along with the number of duplicates.
For example:
-- List
lst = [blue, green, green, yellow, yellow, yellow, orange, orange, silver, silver, silver, silver]
-- Count Number of Duplicates by X
-- Print List Item & Total Number of Occurrences for Output in Sorted list name Order
Color: blue, Total: 1
Color: green, Total: 2
Color: orange, Total: 2
Color: sliver, Total: 4
Color: yellow, Total: 3
I am able to complete the above using dictionaries, along with converting the list to a set. My goal is to complete this task all within the list type using the built in functions of Python 3.