[Tutor] Program Questions (original) (raw)
mandy bowen leomandy at hotmail.com
Thu Jul 15 19:31:33 CEST 2004
- Previous message: [Tutor] Re: Program Questions
- Next message: [Tutor] generating list of arguments for lin alg
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I do not have the exact tracebacks because I am at work and do not have the software with me(cannot download it here).
From: Lloyd Kvam <pythonTutor at venix.com> To: mandy bowen <leomandy at hotmail.com> CC: tutor at python.org Subject: Re: [Tutor] Program Questions Date: 15 Jul 2004 12:58:31 -0400
How does it fail??? What's wrong? It's easier to help if we can see the error message, the traceback, and the relevant pieces of program code.
On Thu, 2004-07-15 at 12:45, mandy bowen wrote: > Can someone tell me what I am doing wrong?? I cannot get this program to > run and I want to add exception-handling, GUI, text processing, etc., but > none of these will work unless the base program runs and I cannot figure out > where I have made the mistake... Please Help! > Program as follows: > > > import time > > class Account: > def init(self, initial): > self.balance = initial > self.strdeposit = [] > self.strwithdraw = [] > > def deposit(self, amt): > self.balance = self.balance + amt > self.strdeposit.append(str(time.strftime(%d %b %Y)) + $ + str(amt)) > > def withdraw(self, amt): > self.balance = self.balance amt > self.strwithdraw.append(str(time.strftime(%d %b %Y)) + $ + str(amt)) > > def trans(self): > for i in range(len(self.strdeposit)): > print self.strdeposit[i] + + > > for i in range(len(self.strwithdraw)): > print self.strwithdraw[i] + > > def getbalance(self): > # print self.balance > print str(time.strftime(%d %b %Y) + $ + str(self.balance)) > > class Menu: > def DisplayMenu(self): > print -------------------------------- > print - Main Menu - > print -------------------------------- > print 1. Make A Deposit > print 2. Make A Withdrawal > print 3. View Transactions > print 4. View Account Balance > print 5. Exit > > def MenuOption(self, option, Account): > if option == 1: > print \n > Account.deposit(input(Deposit amount: $)) > print \n > print TRANSACTION COMPLETED > print \n > elif option == 2: > print \n > Account.withdraw(input(Withdraw amount: $)) > print \n > print TRANSACTION COMPLETED > print \n > elif option == 3: > print \n > Account.trans() > print \n > print QUERY COMPLETED > print \n > elif option == 4: > print \n > Account.getbalance() > print \n > print QUERY COMPLETED > print \n > elif option == 5: > exit() > > a = Account(1000.00) > menu = Menu() > menu.DisplayMenu() > print \n > menuitem = input(Enter Your Selection --> ) > while menuitem < 5:_ _> menu.MenuOption(menuitem, a) > menu.DisplayMenu() > print \n > menuitem = input(Enter Your Selection --> ) > > > > > Any help I can get would be greatly appreciated! > Thanks! > Mandy > _> _________________________________ > MSN Toolbar provides one-click access to Hotmail from any Web page FREE > download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/ > _> ________________________ > Tutor maillist - Tutor at python.org > http://mail.python.org/mailman/listinfo/tutor -- Lloyd Kvam Venix Corp. 1 Court Street, Suite 378 Lebanon, NH 03766-1358 voice: 603-653-8139 fax: 801-459-9582
Get fast, reliable Internet access with MSN 9 Dial-up – now 2 months FREE!
http://join.msn.click-url.com/go/onm00200361ave/direct/01/
- Previous message: [Tutor] Re: Program Questions
- Next message: [Tutor] generating list of arguments for lin alg
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]