Created
August 8, 2012 08:54
-
-
Save erget/3293601 to your computer and use it in GitHub Desktop.
Example of how functions interpret arguments
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
def example_function(argument1, argument2): | |
''' | |
The function takes whatever is given to it as argument1 and argument2. | |
It then assigns the values it was given to the variables argument1 and argument2. | |
''' | |
print('argument1 is ' + str(argument1)) | |
print('argument2 is ' + str(argument2)) | |
print("I'll now call the function with the values 2 and 135. \n") | |
example_function(2, 135) | |
print("Now I'll give it two variables that are named 'tom' and 'bob'. \n" | |
"They have the values 'string' and 19782.075.") | |
tom = 'string' | |
bob = 19782.075 | |
example_function(tom, bob) | |
# Run this script and see what happens! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment