Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Optional Arguments
course content

Course Content

Python Functions Tutorial

Challenge: Optional ArgumentsChallenge: Optional Arguments

Task

You have to write a function that calculates the total cost of some product based on the information about its price, quantity, discount and tax_rate. Take into account that discount and tax_rate are optional parameters and must have default values.

  1. Set the default value of the discount argument equal to 0;
  2. Set the default value of the tax_rate argument equal to 0.1;
  3. Calculate the cost with default discount and tax_rate equals 0.15;
  4. Calculate the cost with default tax_rate and discount equals 0.2.

Everything was clear?

Section 2. Chapter 2
toggle bottom row
some-alt