Problem 178715 · medium · Level 01 Prerequisites & Setup

Tiered Electricity Bill

functions · arithmetic · min and max · rounding

An electricity company charges $0.10 per kWh for the first 100 kWh in a month and $0.15 per kWh for everything above 100. Write electric_bill(kwh) returning the bill rounded to 2 decimal places.

Examples

Input:  kwh = 150
Output: 17.5
Input:  kwh = 80
Output: 8.0

Constraints

  • 0 <= kwh <= 10**6 (may be a decimal)

Goals

  • Split a quantity into a first tier and an overflow tier without an if statement
  • Apply a different rate to each tier
Starting Python…