Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created December 5, 2017 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/be81dc4ab1a26328785ed8cffce33346 to your computer and use it in GitHub Desktop.
Save anonymous/be81dc4ab1a26328785ed8cffce33346 to your computer and use it in GitHub Desktop.
linear_search
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