Python “set” with duplicate/repeated elements
问题 Is there a standard way to represent a "set" that can contain duplicate elements. As I understand it, a set has exactly one or zero of an element. I want functionality to have any number. I am currently using a dictionary with elements as keys, and quantity as values, but this seems wrong for many reasons. Motivation: I believe there are many applications for such a collection. For example, a survey of favourite colours could be represented by: survey = ['blue', 'red', 'blue', 'green'] Here,