Skip to content

Commit ba52392

Browse files
authored
Add set examples (#28)
1 parent 777562f commit ba52392

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

basics/sets_example.py

100644100755
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ def main() -> None:
99
True
1010
>>> "c" in languages
1111
False
12+
>>> my_langs = {"Python", "Golang", "C"}
13+
>>> sorted(list(my_langs & languages))
14+
['C', 'Python']
15+
>>> sorted(list(my_langs | languages))
16+
['C', 'Golang', 'Java', 'JavaScript', 'Python']
17+
>>> sorted(list(my_langs ^ languages))
18+
['Golang', 'Java', 'JavaScript']
19+
>>> sorted(list(my_langs - languages))
20+
['Golang']
21+
>>> sorted(list(languages - my_langs))
22+
['Java', 'JavaScript']
1223
"""
1324

1425

0 commit comments

Comments
 (0)