Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Usage of set () function in python
Usage of set () function in python
Use SET in PYTHON.

Software: Python version

Computer: WIN 10

System: 3.2 Free of charge

There are no duplicate values in the 1 and set collections. Set is in the form of {item 1, item2...}. Create a set: s = {1, 2,3} or s= set () or s= set(( 1, 2,3)). Duplicate elements in the set will be automatically filtered out.

2. Add and delete elements set_name.add(item), set_name.remove(item) and set_name.pop ().

3. Use operators to calculate the union, intersection and difference sets of two sets.

4. Use operators to calculate the union, intersection and difference sets of two sets.

5. Calculate the union, intersection and difference of two sets by the method of intersection, union and difference of sets.