Your question is Babysitter Pay Quote Calculator. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Upstart's quote calculator needs to price a babysitting request where each successive block of hours may have a different hourly rate. Given the requested number of hours and an ordered rate schedule, calculate the total quote in cents.
Apply hours to tiers from first to last. Each tier contains a maximum number of hours and a rate in cents per hour. A tier with a limit of null covers all remaining hours. The schedule is guaranteed to provide enough capacity for every request.
Implement calculate_babysitter_quote(hours, tiers), where hours is a nonnegative integer and tiers is a list of [limit, rate_cents] pairs. Return the total price as an integer number of cents.
def calculate_babysitter_quote(hours, tiers):