# Electricity bill calculation
"""
Tariff rates in TN
Scheme |
Unit |
Per unit(₹) |
0 to 100 |
0-100 |
0 |
0 to 200 |
0-100 |
0 |
101-200 |
1.5 |
|
0 to 500 |
0-100 |
0 |
101-200 |
2 |
|
201-500 |
3 |
|
> 500 |
0-100 |
0 |
101-200 |
3.5 |
|
201-500 |
4.6 |
|
>500 |
6.6 |
"""
Unit = int(input("Enter number of units : "))
L = [[0],[0,1.5],[0,2,3],[0,3.5,4.6,6.6]]
Bill = 0
if(Unit>=0 and Unit<=100):
Bill = 0
elif(Unit<=200):
Bill =
(Unit-100)*L[1][1]
elif(Unit<=500):
Bill =
100*L[2][1]+(Unit-200)*L[2][2]
else:
Bill =
100*L[3][1]+300*L[3][2]+(Unit-500)*L[3][3]
print("Unit :", Unit)
print("Bill : Rs.", Bill)
"""
Sample output
>python EBBill.py
Enter number of units : 510
Unit : 510
Bill : Rs. 1796.0
"""
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu