Sets
Behave mostly like lists with the distinction that they can not contain duplicate values.
Example: check wether there are duplicates in a list or not:
With a for loop:
Withsets
:
Other methods
Intersection
You can intersect two sets.
Example:
Difference
You can find the invalid values in the above example using the difference method.
Example:
You can also create sets using the new notation:
Last updated