# set time complexity python

```# empty set, avoid using {} in creating set or dictionary is created
x = set()

# set {'e', 'h', 'l', 'o'} is created in unordered way
B = set('hello')

# set{'a', 'c', 'd', 'b', 'e', 'f', 'g'} is created
A = set('abcdefg')

# set{'a', 'b', 'h', 'c', 'd', 'e', 'f', 'g'}

fruit ={'orange', 'banana', 'pear', 'apple'}

# True  fast membership testing in sets
'pear' in fruit

'mango' in fruit     # False

A == B       # A is equivalent to B

A != B       # A is not equivalent to B

A <= B    # A is subset of B A = B

A > B     # A is proper superset of B

A | B        # the union of A and B

A & B     # the intersection of A and B

A - B        # the set of elements in A but not B

A ˆ B        # the symmetric difference

a = {x for x in A if x not in 'abc'}   # Set Comprehension```

Here is what the above code is Doing:
1. We create a set called A and set it equal to the set of all the letters in the string ‘abcdefg’.
2. We create a set called B and set it equal to the set of all the letters in the string ‘hello’.
3. We create a set called C and set it equal to the set of all the letters in the string ‘abc’.
4. We create a set called D and set it equal to the set of all the letters in the string ‘def’.
5. We create a set called E and set it equal to the set of all the letters in the string ‘efg’.
6. We create a set called F and set it equal to the set of all the letters in the string ‘fgh’.
7. We create a set called G and set it equal to the set of all the letters in the string ‘ghi’.
8. We create a set called H and set it equal to the set of all the letters in the string ‘hij’.
9. We create a set called I and set it equal to the set of all the letters in the string ‘ijk’.
10. We create a set called J and set it equal to the set of all the letters in the string ‘jkl’.
11. We create a set called K and set it equal to the set of all the letters in the string ‘klm’.
12. We create a set called L and set it equal to the set of all the letters in the string ‘lmn’.
13. We create a set called M and set it equal to the set of all the letters in the string ‘mno’.
14. We create a set called N and set it equal to the set of all the letters in the string ‘nop’.
15. We create a set called O and set it equal to the set of all the letters in the string ‘opq’.
16. We create a set called P and set it equal to the set of all the letters in the string ‘pqr’.
17. We create a set called Q and set it equal to the set of all the letters in the string ‘qrs’.
18. We create a set called R and set it equal to the set of all the letters in the string ‘rst’.
19. We create a set called S and set it equal to the set of all the letters in the string ‘stu’.
20. We create a set called T and set it equal to the set of all the letters in the string ‘tuv’.
21. We create a set called U and set it equal to the set of all the letters in the string ‘uvw’.
22. We create a set called V and set it equal to the set of all the letters in the string ‘vwx’.
23. We create a set called W and set it equal to the set of all the letters in the string ‘wxy’.
24. We create a set called X and set it equal to the set of all the letters in the string ‘xyz’.
25. We create a set called Y and set it equal to the set of all the letters in the string ‘yz’.
26. We create a set called Z and set it equal to the set of all the letters in the string ‘z’.
27. We create a set called a and set it equal to the set of all the letters in the string ‘abcdefghijklmnopqrstuvwxyz’.
28. We create a set called b and set it equal to the set of all the letters in the string ‘defghijklmnopqrstuvwxyz’.
29. We create a set called c and set it equal to the set of all the letters in the string ‘efghijklmnopqrstuvwxyz’.
30. We create a set called d and set it equal to the set of all the letters in the string ‘fghijklmnopqrstuvwxyz’.
31. We create a set called e and set it equal to the set of all the letters in the string ‘ghijklmnopqrstuvwxyz’.
32. We create a set called f and set it equal to the set of all the letters in the string ‘hijklmnopqrstuvwxyz’.
33. We create a set called g and set it equal to the set of all the letters in the string ‘ijklmnopqrstuvwxyz’.
34. We create a set called h and set it equal to the set of all the letters in the string ‘jklmnopqrstuvwxyz’.
35. We create a