Created
February 22, 2017 13:49
-
-
Save joetechem/e87684abd13e8875a3516733275175cf to your computer and use it in GitHub Desktop.
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
# 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 "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