An electric power distribution company charges its domestic consumers as follows:
Consumption Units | Rate of Charges |
0-100 | Rs. 1 per unit |
101-300 | Rs. 100 plus Rs. 1.25 per unit in excess of 100 |
301-500 | Rs. 350 plus Rs. 1.50 per unit in excess of 300 |
500 and above | Rs. 650 plus Rs. 1.75 per unit in excess of 500 |
Below is a program that read the customer number & power consumed and prints the amount to be paid by the customer. You will note that output is also well formatted. Let’s start below
customerNo=int(input("Enter customer number : "))
units=int(input("Enter the power consumed :"))
if units>0 and units<=100 :
billAmt=units*1
elif units>100 and units<=300 :
billAmt=100+(units-100)*1.25
elif units>300 and units<=500 :
billAmt=350+(units-300)*1.50
elif units>500:
billAmt=650+(units-500)*1.75
else:
print("Invalid Input, please try again. ")
print("~"*60)
print("\t\t\t PSPCL BILL ")
print("~"*60)
print("\t\tPayable Bill Amount :INR " +str(billAmt))
print("-"*60)
Output:
- Python tutorials
- Input and Output in Python
- f-strings in Python
- end and sep in Python
- Python QuickStart
- Variables in Python
- Data Types in Python
- Operators in Python
- Python program to compute net run rate
- Python program to get biggest number
- Python program to count the frequency of every element
- Python program of list and swap its content
- Python program to get max numbers
- Python program to generate patterns
- Python Program to Check Armstrong
- Python program to print multiplication table
- Python program for domestic electricity bill
- Python program to find maximum number
- Python program to check uppercase or lowercase letter