Bill generation program in Python. Python program to calculate electricity bill

Bill generation program in Python. Python program to calculate electricity bill

In this article we are going to see about finding the EB Bill using python platform and also given the full project download link below 

Program Explanation 

  1. Declare total unit consumed by the customer using the variable unit.
  2. If the unit consumed less or equal to 100 units, calculates the total amount of consumed =units*1.5
  3. If the unit consumed between 100 to 200 units, calculates the total amount of consumed=(100*1.5)+(unit-100)*2.5)
  4. If  unit consumed between 200 to 300 units ,calculates total amount ofconsumed=(100*1.5)+(200-100)*2.5+(units-200)*4
  5. If unit consumed between 300-350 units ,calculates total amount of consumed=(100*1.5)+(200-100)*2.5+(300-200)*4+(units-350)*5
  6. If the unit consumed above 350 units, fixed charge – 1500/=

EB Bill Generation


Condition for Additional charges apply 

  • if units<=100 – 25.00
  • if 100< units and units<=200 – 50.00
  • if 200 < units and units<=300 – 75.00
  • if 300<units and units<=350 – 100.00
  • if units above 350 – No additional charges

Electricity bill calculation (Code) 

#program for calculating electricity bill in Python using and operator

units=int(input("Number of unit consumed: "))

if(units>0 and units<=100):

    payAmount=units*1.5

    fixedcharge=25.00

elif(units>100 and units<=200):

    payAmount=(100*1.5)+(units-100)*2.5

    fixedcharge=50.00

elif(units>200 and units<=300):

    payAmount=(100*1.5)+(200-100)*2.5+(units-200)*4

    fixedcharge=50.00

elif(units>300):

    payAmount=2500;#fixed rate

    fixedcharge=75.00

else:

    payAmount=0;

Total= payAmount+fixedcharge

print("\nElecticity bill pay=%.2f: " %Total);


Result 

Number of unit consumed: 234

Electricity bill pay=586.00


Download  EB GENERATION Full project file

    


Post a Comment

If you any doubts, Please let me know

Previous Post Next Post