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 10 Programs for Beginners
- Find index of first occurrence when an unsorted array is sorted
- Find sum non repeating distinct elements array
- Find the only different element in an array
- Queries to find first occurrence of a character in a given range
- Program count occurrences of given character in string
- Find repeating element in sorted array of size n
- Find only non repeating element in a given array
- Python replace all occurrences of a substring in a string
- Count occurrences of a sub string with one variable character
- Python string replace
- Python string strip
- Slicing with negative numbers in Python
- Python Slice Function
- String Slicing in Python
- Python String
- Chainmap in Python
- Collections Userlist in Python
- Collections Userstring in Python
- Defaultdict in Python
- Deque in Python
- Namedtuple in Python
- Ordereddict in Python
- Counters in Python
- Python list
- Python Dictionary
- Python Tuples
- Collections Userdict in Python
- Python Collections Module
- end and sep in Python
- f-strings in Python
- Input and Output in Python
- 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
- Python tutorials
- Python QuickStart