Question 1
Write a function compute_electricity_bill(units) that returns the bill for units units of electricity. The whole consumption is charged at the rate of the slab it falls in:
- up to 200 units: 0.50 per unit.
- 201 to 400 units: 0.75 per unit, plus a fixed charge of 150.
- more than 400 units: 0.90 per unit, plus a fixed charge of 300.
The bill you return is compared after rounding it to 4 decimal places.
NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.
Example
compute_electricity_bill(200) -> 100
compute_electricity_bill(412) -> 670.8
Your task
Implement this function:
def compute_electricity_bill(units: int) -> float:
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: units.
Example
Input
200
Output
100