Skip to content

Commit 3e23f3e

Browse files
committed
Python Sets Snippets
1 parent be8c7c6 commit 3e23f3e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Diff for: Python/Python-Sets/sets.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
employees = ['Corey', 'Jim', 'Steven', 'April', 'Judy', 'Jenn', 'John', 'Jane']
3+
4+
gym_members = ['April', 'John', 'Corey']
5+
6+
developers = ['Judy', 'Corey', 'Steven', 'Jane', 'April']
7+
8+
if 'Corey' in developers:
9+
print('Found!')
10+
11+
# O(n) for list
12+
# O(1) for a set

Diff for: Python/Python-Sets/snippets.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
s1 = {1, 2, 3}
3+
s2 = {2, 3, 4}
4+
s3 = {3, 4, 5}
5+
6+
# print(s4)
7+
8+
9+
employees = ['Corey', 'Jim', 'Steven', 'April', 'Judy', 'Jenn', 'John', 'Jane']
10+
11+
gym_members = ['April', 'John', 'Corey']
12+
13+
developers = ['Judy', 'Corey', 'Steven', 'Jane', 'April']

0 commit comments

Comments
 (0)