Calasiao water district charges its customers P10 per unit for the first ten units of water consumption, P15 per unit for the next five units, and P17 for the succeeding units. Write a program that inputs the previous meter reading and the present meter reading, then display the number of units consumed and the water bill.
prev_meter=int(input("Enter the previous meter reading: "))
pre_meter=int(input("Enter the present meter reading: "))
def waterbill(prev_meter,pre_meter):
consumed=pre_meter-prev_meter
print("The number of units of water consumed is {}".format(consumed))
if consumed<=10:
water_bill=10*consumed
elif 10<consumed<=15:
water_bill=15*consumed
else:
water_bill=17*consumed
print("The water bill is P{}".format(water_bill))
waterbill(prev_meter,pre_meter)
Enter the previous meter reading: 10
Enter the present meter reading: 18
The number of units of water consumed is 8
The water bill is P80
Comments
Leave a comment