Created
July 30, 2014 18:44
-
-
Save odubno/93b5b367993396f2374f to your computer and use it in GitHub Desktop.
Overview of Functions in Python - LESSON 5 - FUNCTIONS ASSIGNMENT 1
This file contains hidden or 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
"""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