Pybiller-My first python prog to calc elec bill

Status
Not open for further replies.

gopi_vbboy

Cyborg Agent
Code:
#gopi_vbboy-8/06/09
#Pybiller:Billing for A.P.DCL Tarrif
#change as per ur tarrif
#  0-50       145
#  51-100     280
# 101-200     305
# 201-300     475
#Above 300     550

#slabs
s1=51
s2=101
s3=201
s4=301




#cost for each slabs
a=1.45
b=2.8
c=3.05
d=4.75
e=5.5


print("Enter Net Units")

kwh=int(input())

if kwh<s1:
    print("Cost Rs",kwh*a)
elif kwh<s2:
    print("Cost Rs",(s1-1)*a+(kwh-s1)*b)
elif kwh<s3:
    print("Cost Rs",(s1-1)*a+(s2-s1)*b+(kwh-s2+1)*c)
elif kwh<s4:
    print("Cost Rs",(s1-1)*a+(s2-s1)*b+ (s3-s2)*c+(kwh-s3+1)*d)
elif kwh>s4:
    print("Cost Rs",(s1-1)*a+(s2-s1)*b+ (s3-s2)*c+(s4-s3)*d+(kwh-s4+1)*e)

print("+25-40rs tax/charges")
pls comment...my first python prog... learning now..:-D
 

Nawab

Broken In
nice try... its good you r also following indentation

it'll help in larger code debugging... keep it up
 
Status
Not open for further replies.
Top Bottom