Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
5. Question 4


Good job! All right, let's write a function now.


Create a function named calculate_rental_cost(days, age) that calculates the cost of a car rental. The rules are as follows:

  • The daily base fare is 100 USD for drivers who are at least 30, or 220 USD for younger drivers.
  • Every seventh day of the rental is free of charge.

When the arguments are not provided, the function takes the following default values: a 30-year-old driver who rents a car for 1 day.

Stuck? Here's a hint!

To calculate how many days are free of charge, you can use floor division: days // 7.