Skip to content

Commit

Permalink
Python Sets Snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
CoreyMSchafer committed Jun 20, 2018
1 parent be8c7c6 commit 3e23f3e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Python/Python-Sets/sets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

employees = ['Corey', 'Jim', 'Steven', 'April', 'Judy', 'Jenn', 'John', 'Jane']

gym_members = ['April', 'John', 'Corey']

developers = ['Judy', 'Corey', 'Steven', 'Jane', 'April']

if 'Corey' in developers:
print('Found!')

# O(n) for list
# O(1) for a set
13 changes: 13 additions & 0 deletions Python/Python-Sets/snippets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

s1 = {1, 2, 3}
s2 = {2, 3, 4}
s3 = {3, 4, 5}

# print(s4)


employees = ['Corey', 'Jim', 'Steven', 'April', 'Judy', 'Jenn', 'John', 'Jane']

gym_members = ['April', 'John', 'Corey']

developers = ['Judy', 'Corey', 'Steven', 'Jane', 'April']

0 comments on commit 3e23f3e

Please sign in to comment.