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
See packing in action with a practical example.
This video doesn't have any notes.
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
For this example, let's say we're
building a simple shopping cart app.
0:00
We'll write a function
called calculate_total.
0:03
The job of calculate_total is to
add up the price of every item in
0:11
the shopping cart.
0:14
If I was coding this with
positional arguments,
0:16
I might add parameters like item1,
item2, item three.
0:19
But where do I stop?
0:24
How do I know how many parameters to add?
0:26
The short answer is I don't.
0:28
And neither does our function.
0:29
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