Re: Simple account program
ah thank you again. Anyone know of a good place to get information about TK inter. I am gonna try and make this program somewhat of a GUI. Thank you again. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple account program
Question then, do I do an import pickle pickle.dump ((withdrawl), file ('account.pickle', 'w')) pickle.dump ((deposit), file ('account.pickle', 'w')) Am I on the right track? -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple account program
I was looking at both the programs and I got Dennis Lee Bieber's code to work, then I tried the imporvements from Chris Reberts code but was unable to get it to run. It said EOL error. I took out got and tried to move it around but it didn't take. I took the else code at the end so that other keys cannot be entered. I also see at the begining you are defining what a deposit and withdrawl is. Ironically our next assignment is to make this program handle errors and try to implement a GUI. I'm going to use the GUI feauture and see what I come up with. Thank you all for your help. I know I will be coding proper some day in the future. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple account program
Thank you all for your help. I am sorry that I am struggling with programming. I still am attempting to get it. Yes, I do need to stop posting homework assignments, perhaps I will learn to write code through more studying. I have gone through some toutorials if that makes you feel any better. I do have a desire to learn. Thank you again. I will go back and attempt to impliment this. -- http://mail.python.org/mailman/listinfo/python-list
Simple account program
Hello all, I am still needing some help on this code, I have gone a bit further on it. Thank you for the help. I am trying to understand how to make the file searchable and how I am to make the deposit and withdrawl interact with the transaction class. I need to just search the file only for the deposits and withdrawls and the amount in the account with a time stamp. Thank you for your assistance. class Account: def __init__(self, initial): self.balance = initial def deposit(self, amt): self.balance = self.balance + amt def withdraw(self, amt): self.balance = self.balance - amt def getbalance(self): return self.balance class Transactoin: def transaction(self, self.transaction = import time time.asctime() raw_input(Is this a deposit or withdrawl?) if withdrawl: elif raw_input(Please enter amount here.) class Deposit(Transaction): def deposit(self, amt): self.balance = self.balance + amt def getbalance(self): return self.balance class Withdrawl(Trasaction): def withdrawl(self, amt): self.balance = self.balance - amt def getbalance(self): return self.balance import pickle pickle.dump ((withdrawl), file ('account.pickle', 'w')) pickle.dump ((deposit), file ('account.pickle', 'w')) print Your current account total is., self.balance -- http://mail.python.org/mailman/listinfo/python-list
Re: Coding help...very basic
Hello all, I am still needing some help on this code, I have gone a bit further on it. Thank you for the help. I am trying to understand how to make the file searchable and how I am to make the deposit and withdrawl interact with the transaction class. class Account: def __init__(self, initial): self.balance = initial def deposit(self, amt): self.balance = self.balance + amt def withdraw(self, amt): self.balance = self.balance - amt def getbalance(self): return self.balance class Transactoin: def transaction(self, self.transaction = import time time.asctime() raw_input(Is this a deposit or withdrawl?) if withdrawl: elif raw_input(Please enter amount here.) class Deposit(Transaction): def deposit(self, amt): self.balance = self.balance + amt def getbalance(self): return self.balance class Withdrawl(Trasaction): def withdrawl(self, amt): self.balance = self.balance - amt def getbalance(self): return self.balance import pickle pickle.dump ((withdrawl), file ('account.pickle', 'w')) pickle.dump ((deposit), file ('account.pickle', 'w')) print Your current account total is., self.balance -- http://mail.python.org/mailman/listinfo/python-list
Coding help...very basic
I need some ideas of how to accomplish this task. I was told that I just need to save the input in a file and make the file searchable, nothing fancy like tying into SQL or Oracle. THis is a basic program and help is greatly appreciated: You've been given an assignment by your supervisor to program a small application to monitor the current status of the cash account in the firm's petty cash fund (the amount of cash kept on hand in the office for incidental purchases). The requirements for the program are to allow users to input the amount of cash deposited, the amount of cash withdrawn and to get a report of the balance at any given time. You will need to also add the date of each deposit and the date of each withdrawal and provide a date with the balance returned upon a given query. The program should be able to provide a printed report and support a command line query. You are to use the object oriented properties of Python to accomplish this task. -- http://mail.python.org/mailman/listinfo/python-list
Re: Coding help...very basic
Thank both for the help. I understand that I should provide code, I am still trying to understand what to do, I don't want the work done, just some ideas of where to go, a general layout perhaps. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Coding help...very basic
This is just a basic of what I have so far. The time , a class I will need and the print function. class Account: def __init__(self, initial): self.balance = initial def deposit(self, amt): self.balance = self.balance + amt def withdraw(self,amt): self.balance = self.balance - amt def getbalance(self): return self.balance import time time.asctime() import win32api source_filename = log.txt win32api.ShellExecute ( 0 print source_filename None . 0) -- http://mail.python.org/mailman/listinfo/python-list
Re: NOOB coding help....
Thank you, that does help quit a bit. I am working on the corrections now. To the first poster... don't know what that meant. I thought I made my case understandable. Thank you again. I will work on that. I was attempting to open wade_stoddard... b/c that was my file I was working with, and I was told I had to open it in order to save information to another file so I could recall that information. Thank you again for the help Steven. -- http://mail.python.org/mailman/listinfo/python-list
Re: NOOB coding help....
#This program will ask for a user to imput numbers. The numbers will then be calculated #to find the statistical mean, mode, and median. Finallly the user will be asked #if he would like to print out the answers. numbers = [ ] print 'Enter numbers to add to the list. (Enter 0 to quit.)' def getint(): return int(raw_input('Number? ')) numbers = sorted(iter(getint, 0)) numbers [2, 3, 5, 7] def variable_median(x): return sorted(x)[len(x)//2] def variable_mode(x): counts = {} for item in x: counts[x] = counts.get(x, 0) + 1 return sorted(counts, key=counts.__getitem__, reverse=True)[0] s = variableMean(numbers) y = variableMedian(numbers) t = variableMode (numbers) import pickle pickle.dump((s, y, t), file('avg.pickle', 'w')) print 'Thank you! Would you like to see the results after calculating' print 'The mode, median, and mean? (Please enter Yes or No)' print 'Please enter Yes or No:' if raw_input == yes: f = open(avg.py,r) avg.py = f.read() print 'The Mean average is:', mean print 'The Median is:', meadian print 'The Mode is:', mode I got the error: Traceback (most recent call last): File C:\Python24\Lib\New Folder\Wade_StoddardSLP3-2.py, line 9, in ? numbers = sorted(iter(getint, 0)) File C:\Python24\Lib\New Folder\Wade_StoddardSLP3-2.py, line 7, in getint return int(raw_input('Number? ')) TypeError: 'str' object is not callable and this one for my if statement: Traceback (most recent call last): File C:\Python24\Lib\New Folder\Wade_StoddardSLP3-2.py, line 39, in ? if raw_input == Yes: NameError: name 'Yes' is not defined I cannot understand how I can define yes so that when they type yes the data is printed out. Also if they type no how do I make the program do nothing. Or is that just infered. -- http://mail.python.org/mailman/listinfo/python-list
NOOB coding help....
Ok, this is what I have so far: #This program will ask for a user to imput numbers. The numbers will then be calculated #to find the statistical mean, mode, and median. Finallly the user will be asked #if he would like to print out the answers. list = [ ] a = 1 print 'Enter numbers to add to the list. (Enter 0 to quit.)' while a != 0 : a = input('Number? ') list.append(a) zero = list.index(0) del list[zero] list.sort() variableMean = lambda x:sum(x)/len(x) variableMedian = lambda x: x.sort() or x[len(x)//2] variableMode = lambda x: max([(x.count(y),y) for y in x])[1] s = variableMean(list) y = variableMedian(list) t = variableMode (list) x = (s,y,t) inp = open (Wade_StoddardSLP3-2.py, r) outp = open (avg.py, w) f = (avg.py) for x in inp: outp.write(x) import pickle pickle.dump(x, f) print 'Thank you! Would you like to see the results after calculating' print 'The mode, median, and mean? (Please enter Yes or No)' raw_input('Please enter Yes or No:') if raw_input == Yes: f = open(avg.py,r) avg.py = f.read() print 'The Mean average is:', mean print 'The Median is:', meadian print 'The Mode is:', mode I am attempting to make it so that I can save the mean, meadian, and mode and then if the user wants the data to give it to him. Thank you for any assistance you can provide! Wade -- http://mail.python.org/mailman/listinfo/python-list