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

What are Large Language Models

LLM stands for Large Language Model in the context of artificial intelligence. It refers to a type of AI model designed to understand, generate, and manipulate human language on a

Explain about Hugging Face Transformers

Hugging Face Transformers is a powerful library designed for natural language processing (NLP), computer vision, and audio tasks. It provides state-of-the-art pretrained models and tools for fine-tuning and deploying these

Create new Python Virtual environment

Create a new virtual environment  Python 3 allows you to manage separate package installations for different projects. It creates a “virtual” isolated Python installation. When you switch projects, you can