Course Content
Python Functions Tutorial
1. What is Function in Python?
3. Function Return Value Specification
4. Some Additional Topics
Python Functions Tutorial
Challenge: 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.
- Set the default value of the
discount
argument equal to0
. - Set the default value of the
tax_rate
argument equal to0.1
. - Calculate the cost with default
discount
andtax_rate
equals0.15
. - Calculate the cost with default
tax_rate
anddiscount
equals0.2
.
Everything was clear?
Section 2. Chapter 2