What are the basic codes of electricity bill using python program?

–3 votes
asked Feb 6 by carl

2 Answers

0 votes
answered Feb 9 by anonymous
rate = float("Enter electricity rate :")

old_reading = float("Enter old reading :")

new_reading = float("Enter new reading :")

x = new_reading - old_reading

cost = rate*x

print("Your electricity bill is :",cost)
0 votes
answered Feb 10 by KOMMANABOYINA VENKATA NIKHL
fc=25
units=int(input("enter the no of units:"))
if (units>0 and units<100):
    pay=(units*1.5)+fc
    print('amount has to pay=',(pay))
elif(units>100 and units<200):
    pay=(units*1.5)+(units-100)*2.5+fc+25
    print('amount has to pay=',(pay))
elif(units>200 and units<300):
    pay=(units*1.5)+(units-100)*2.5+(units-200)*2.5+fc+50
    print('amount has to pay=',(pay))
elif(units>300 and units<400):
    pay=(units*1.5)+(units-100)*2.5+(units-200)*4+(units-300)*5+fc+75
    print('amount has to pay=',(pay))
elif(units>=500):
    pay=1500+fc+100
    print(pay)
else:
    pay=100+fc
    print(pay)
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...