* FAQ    * Search  * Register * Login 
Active topics
Unanswered topics

All times are UTC-06:00



Post new topic  Reply to topic  [ 1 post ] 
Author Message
 Post subject: Simple program for class
PostPosted: Sat Sep 25, 2010 3:28 pm 
Offline
DBB Artist
DBB Artist
User avatar

Joined: Mon Aug 01, 2005 8:47 am
Posts: 7124
Location: Ơ̸̦͇̲̬̭̱̰͎̞͈̣͎͚̳ͬ͋̃̀̇͊͂͋͐ͦ̽ͣ̂ͥ͊̅̀̚͠ B̶͖̯͉̜̰̲̓̔͋̈́ͅ È̯ Y̪̤̼͉̠̙͝
This is meant to be used after being imported into the Python terminal. After its loaded each account is its own instance which returns a usable value, like Cash.bal(). Examples:>>> AcPay.add(Cash.bal()-513.30) >>> Cash.add(50000)
To keep track of all the accounts I type dir()
It's simple but I'm a beginner.
Code:
class account:
   def __init__(self):
      self.all = []
   def add(self, dollarval):
      self.all.append(dollarval)
   def show(self):
      a=1
      for transactions in self.all:
         print a,\")  $\", transactions
         a+=1
   def bal(self):
      a=0
      for transactions in self.all:
         a=transactions+a   
      return a
   def u(self):
      del self.all[-1]


Note: python is a hobby of mine, but I use it for school as a calculator.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC-06:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron



Descent'rs have piloted these pages
 
The layout and contents contained within this site are © DescentBB.net 1997-2006.
Descent, Descent II are © Parallax Software Corporation.
Descent III is Outrage Entertainment.
Descent is a Trademark of Interplay Productions.

Miner Wars™ is trademark of Keen Software House s. r. o.
.


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group