Hunter W. answered 10/27/20
BS in Computer Science specializing in Python
The characteristic function of a set is to hold distinct values. Sets are typically used to verify membership. A set cannot have the same value repeated.
Some examples:
Example 1) Given a list of values say: [1,2,2,3,4,5] the set of this list would be {1,2,3,4,5} because sets only include the unique values.
Example 2) List is ['John', 'Max', 'John', 'James'] the set is {'John', 'Max', 'James'} assuming we are talking about the same 'John'.
Example 3) A set doesn't have to be in any order: {2, 4, 1, 8, 3} is a set.