no matter how I code this, I cannot get self.argument to append to self.a correctly.Code:from sys import exit class adder(object): def __init__(self): self.a = [] self.item = [] self.argument=0 def dictCopy(*args): pass def adder(self,*args): for item in args: print item raw_input() if type(item)!=int and type(item) != float: print 'not a number' if type(item) == list: print item self.item = item listOccourance(self.item) continue else: self.a.append(item) print self.a print sum(self.a) def listOccourance(self, argument): self.argument = argument print self.argument print 'It seems that you have a list in here. How do you want to handle that?' print 'Press 1 to nest this list.\n Press 2 to take the sum thus far and append that to the list.' print 'Press 3 to do nothing.' choice = raw_input() if choice == 1: self.a.append(self.argument) print self.a raw_input() elif choice == 2: self.argument.append(sum(self.a)) print self.argument raw_input exit(0) elif choice == 3: #this will default to back to list a pass
Bookmarks