Learn

We covered a lot of ground in this lesson! We learned all about how functions can accept different arguments and different styles in which we can pass those arguments in. We learned:

  • How to pack positional arguments in a function with *args.
  • How to work with *args using iteration and other positional arguments.
  • How to pack keyword arguments in a function with **kwargs.
  • How to work with **kwargs using iteration and other keyword arguments.
  • How to combine all different types of arguments to gain the most flexibility in our function declarations.
  • How to use an unpacking operator (* or **) to unpack arguments in a function call.
  • How to use an unpacking operator (* or **) on iterables.

We should now be able to read many different styles of function writing in Python and come up with ways to call those functions with style and clarity.

Instructions

Take some time to examine the application we built for Jiho. The program has been adjusted to account for the payment calculation from the previous step!

Play around and have fun with our new knowledge of function arguments. Here is some additional functionality that Jiho might like:

  • The ability to remove a table’s guests when they leave the restaurant.
  • An adjustment to the calculate_price_per_person() function to access a tables 'total' and return the result.
  • The ability to add and remove order items for both food and drinks if there is ever a mistake.
  • The ability to queue reservations for later times for specific tables.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?