#introducing python
#set combinations and operators
a = {1, 2}
b = {2, 3}
print(a & b)
print(a.intersection(b))
>>> {2}
print(a | b)
print(a.union(b))
>>> {1,2,3}
print(a-b)
print(a.difference(b))
>>> {1}
print(a^b)
print(a.symmetric_difference(b))
>>>{1, 3}
'Python > Python__works' 카테고리의 다른 글
python slacker 한글 깨지는 현상 (0) | 2019.06.11 |
---|---|
iterate multiple sequences with zip (0) | 2019.06.03 |
Dictionaries (0) | 2019.06.03 |
introducing python - strings (0) | 2019.05.31 |
python list comprehension (0) | 2019.05.23 |