Write a Python program to input electricity unit charges and calculate total electricity bill according to the given condition:

SOLUTION....

# Program to calculate Electricity Bill

# Input
units = float(input("Enter total electricity units consumed: "))

# Bill calculation
if units <= 50:
    bill = units * 0.50
elif units <= 150:
    bill = (50 * 0.50) + ((units - 50) * 0.75)
elif units <= 250:
    bill = (50 * 0.50) + (100 * 0.75) + ((units - 150) * 1.20)
else:
    bill = (50 * 0.50) + (100 * 0.75) + (100 * 1.20) + ((units - 250) * 1.50)

# Add 20% surcharge
surcharge = bill * 0.20
total_bill = bill + surcharge

# Output
print("Electricity Bill = Rs. ",total_bill)

OUTPUT

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.