Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Function basics
More advanced concepts


Good job! Now that you know the basics, we will introduce some more advanced concepts related to functions.

To start with, it is possible to provide default values for function parameters. Take a look at a function that converts a dog age to a human age (one dog year equals around seven human years):

def dog_to_human_age(dog_age=1):
  return dog_age*7

Note what we did: in the parentheses, we provided a default value for the dog_age parameter (dog_age=1). This means that we can choose to provide no value for this parameter when we invoke the function. In that case the function will simply work with the default value of 1. If we choose to pass in our own value for dog_age, the function will use that new value.


Run the template code.

You can see that the function can be invoked both with (dog_to_human_age(3)) and without (dog_to_human_age()) a parameter.