In: Computer Science
An electricity company charges electricity consumption
according to the following scale.
Up to 200 Units (0-200) to 0.25 € per unit
The next 1000 Units (201-1200) to 0.40 € per unit
Over 1200 units to 0.50 € per unit.
Write a program in python language that accepts the number of units
consumed by the customer and displays the amount of money owed by
the customer to the electricity company
#reading units from user
n=int(input("Enter number of units: "))
total=0
#if units are less than 200
if(n<=200):
total=n * 0.25
#if units are less than 1200 and greater than 200
elif(n<=1200):
total=200 * 0.25
total = total + (n-200) * 0.4
else: #if units are >1200
total=200 * 0.25
total = total + 1000 * 0.4
total = total + (n-1200) * 0.5
print("Total price for ",n,"units $",total)
NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.
Please Like and Support me as it helps me a lot