Skip to content

Instantly share code, notes, and snippets.

@odubno
Created July 30, 2014 18:44
Show Gist options
  • Save odubno/93b5b367993396f2374f to your computer and use it in GitHub Desktop.
Save odubno/93b5b367993396f2374f to your computer and use it in GitHub Desktop.
Overview of Functions in Python - LESSON 5 - FUNCTIONS ASSIGNMENT 1
"""Both codes below provide the same output"""
def subtractor(a, b):
print "I'm a function. My name is {}".format(subtractor.__name__)
print "I'm about to subtract {} and {}\n\n".format(a,b)
if __name__ == '__main__' # Why is this necessary to have in the code if the output is still the same?
subtractor(3, 2)
def subtractor(a, b):
print "I'm a function. My name is {}".format(subtractor.__name__)
print "I'm about to subtract {} and {}\n\n".format(a,b)
subtractor(3, 2)
Output:
I'm a function. My name is subtractor
I'm about to subtract 3 and 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment