Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Functions, Packing, and Unpacking!
You have completed Functions, Packing, and Unpacking!
Preview
What happens when you need to send more than one argument to a function?
Solution
def multiply_two( num1, num2 ):
val = num1 * num2
return val
print(multiply_two( 5, 7))
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
and parameters, let's talk about
sending multiple values to functions.
0:00
The truth is,
there really isn't much of a difference.
0:00
You can send as many arguments
to a function as you want, so
0:02
long as it has a corresponding parameter.
0:05
You simply separate the values with
a comma when you call the function, and
0:08
separate the parameters with
a comma in the function definition.
0:11
Let's revisit the add_two function and
expand on it.
0:14
To recap, the add_two function
receives one argument.
0:18
Stores the value of that
argument in the parameter num.
0:21
Then adds two to that parameter.
0:25
Then it returns the sum.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up