Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 08-06-2009, 09:15 AM   #1 (permalink)
Section Moderator
 
gopi_vbboy's Avatar
 
Join Date: Mar 2007
Location: Hyderabad
Posts: 1,186
Default Pybiller-My first python prog to calc elec bill


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..
gopi_vbboy is online now  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 09-06-2009, 10:15 AM   #2 (permalink)
Right Off the Assembly Line
 
Nawab's Avatar
 
Join Date: Jul 2008
Location: Mobo
Posts: 10
Default Re: Pybiller-My first python prog to calc elec bill

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

it'll help in larger code debugging... keep it up
__________________
++++++++++++++++++++++++++
I hate all liars... except ;)
++++++++++++++++++++++++++
http://www.abhishekkr.co.cc
++++++++++++++++++++++++++
Nawab is offline  
Old 09-06-2009, 11:08 AM   #3 (permalink)
In The Zone
 
unni's Avatar
 
Join Date: Mar 2006
Location: Thiruvananthapuram (Now in Bengaluru)
Posts: 386
Default Re: Pybiller-My first python prog to calc elec bill

Python looks more like C without semicolons.
unni is offline  
Old 09-06-2009, 12:39 PM   #4 (permalink)
Call me D_J!
 
Disc_Junkie's Avatar
 
Join Date: Nov 2008
Location: INDIA
Posts: 866
Default Re: Pybiller-My first python prog to calc elec bill

Good Useful program...
__________________
ASUS K42JA-VX032D RAWKS !!!!!!:grin:
Disc_Junkie is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Sujeet
- by gforz
- by soumya

Advertisement




All times are GMT +5.5. The time now is 03:13 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2