Created
December 3, 2015 15:08
-
-
Save MasazI/6251cc138ab64c0b0b64 to your computer and use it in GitHub Desktop.
hi performance python cp1 search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search_1st(haystack, needle): | |
for item in haystack: | |
if item == needle: | |
return True | |
return False | |
def search_2nd(haystack, needle): | |
val = False | |
for item in haystack: | |
if item == needle: | |
val = True | |
return val | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment