Calculate a household electricity bill where every slab of units has a different rate, plus a fixed charge.
Skills: C / Python, if-else ladders, functions
Based on how slab-wise electricity tariffs work for homes
Electricity bills for homes are calculated in slabs: the first units are cheap and later units cost more. Many people cannot check whether their bill is correct.
Use these sample rates (not an official tariff):
0 – 100 units ₹4.00 per unit
101 – 300 units ₹8.00 per unit
301 – 500 units ₹11.00 per unit
above 500 units ₹13.00 per unit
Fixed charge ₹120 per monthFor 250 units the energy charge is 100 × 4 + 150 × 8 = ₹1600, and the bill is ₹1720.
Create a free student account to submit your work, get mentor feedback and unlock the reference solution.