Created
December 5, 2017 19:23
-
-
Save anonymous/be81dc4ab1a26328785ed8cffce33346 to your computer and use it in GitHub Desktop.
linear_search
This file contains 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 linear_search(array, item): | |
for index, value in enumerate(array): | |
if item == value: | |
return index # found | |
return None # not found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment