Skip to content

Instantly share code, notes, and snippets.

@joetechem
Created February 22, 2017 13:49
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 joetechem/e87684abd13e8875a3516733275175cf to your computer and use it in GitHub Desktop.
Save joetechem/e87684abd13e8875a3516733275175cf to your computer and use it in GitHub Desktop.
# The following is a gist of gist by Wray.
# We know all about loops and conditionals, so let's create a simple search by first name.
# Here's where we define our function
def find_contact_by_first_name(first_name):
for contact in contacts: # and here is our for loop found within the function's block of code
if contact[0] == first_name:
return contact
contact = find_contact_by_first_name("John")
print
print "Contact lookup of 'John' using our custom finder"
print contact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment