An electric power distribution company charges its domestic consumers as follows:

Consumption UnitsRate of Charges
0-100Rs. 1 per unit
101-300Rs. 100 plus Rs. 1.25 per unit in excess of 100
301-500Rs. 350 plus Rs. 1.50 per unit in excess of 300
500 and aboveRs. 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)

Python program for domestic electricity bill

Output:

Python program for domestic electricity bill

Explore More

Python 10 Programs for Beginners

Program 1:Write a program to create a 2D array using NumPy. Output: Program 2: Write a program to convert a python list to a NumPy array. Output: Program 3: Write a program to create matrix of 3×3 from 11 to 30. Output: Program 4: Write a program to create a data frame to store data of candidates who appeared in

Find index of first occurrence when an unsorted array is sorted

Find index of first occurrence when an unsorted an array is sorted Given an unsorted an array and a number x, find an index of first occurrence of x when

Find sum non repeating distinct elements array

Find sum of non-repeating (distinct) elements in an array Given an integer an array with repeated elements, the task is to find the sum of all distinct elements in the