Write a python program to accept the consumer name, EB number, number of units and type
of consumption [ D – Domestic , C – commercial ] Calculate the amount to be paid
based on the following criteria
For Domestic purpose
a. for the first 100 units - No charges
b. for units 101- 200, Rs.7 per unit
c. for units 201-300, Rs. 9.50 per unit
d. for units 301 and above Rs. 12 per unit.
For Commercial purpose
a. for the first 100 , Rs. 10 per unit
b. for units 101- 200, Rs. 25 per unit
c. for units 201-300, Rs. 40 per unit
d. for units 301 and above Rs. 55 per unit.
Print the EB bill in the given format
ELECTRICITY BILL
CONSUMER NAME :
EB NUMBER :
TYPE OF CONSUMPTION :
NUMBER OF UNITS :
TOTAL AMOUNT:
Answers
Answer:
In python 3 . see you then:)
Explanation:
print("CONSUMER NAME :")
name = (input())
print("EB number :")
eb = (input())
print("Enter Total Domestic units if commercial consumer enter 0 ")
total_units_domestic = int(input())
print("Enter Total Commercial units if Domestic consumer enter 0 ")
total_units_commercial = int(input())
charge_domestic=0
charge_commercial=0
if total_units_domestic<=100:
charge_domestic=0
elif total_units_domestic>=101 and total_units_domestic<=200:
charge_domestic=total_units_domestic*7
elif total_units_domestic>=201 and total_units_domestic<=300:
charge_domestic=total_units_domestic*9.5
else :
charge_domestic=total_units_domestic*12
if total_units_commercial<=100:
charge_commercial=total_units_commercial*10
elif total_units_commercial>=101 and total_units_commercial<=200:
charge_commercial=total_units_commercial*25
elif total_units_commercial>=201 and total_units_commercial<=300:
charge_commercial=total_units_commercial*40
else :
charge_commercial=total_units_commercial*55
if total_units_domestic >0:
type = "D"
else:
type = "C"
print("ELECTRICITY BILL")
print("CONSUMER NAME :",name)
print("EB NUMBER :",eb)
print("TYPE OF CONSUMPTION :",type)
print("NUMBER OF UNITS :",(total_units_commercial+total_units_domestic))
print("TOTAL AMOUNT:",(charge_commercial+charge_domestic))