Skip to content

Instantly share code, notes, and snippets.

@newbiethetest
Created November 11, 2013 02:41
Show Gist options
  • Save newbiethetest/7406931 to your computer and use it in GitHub Desktop.
Save newbiethetest/7406931 to your computer and use it in GitHub Desktop.
class GetResult:
def __init__(self):
self.result=[] #here i have changed
def add(self,x,y):
z= x+y
self.result.append(z)
rs=GetResult()
rs.add(1,2) #the result is [3]
print rs.result
rs.add(3,4)#the result is [3, 7] #what i want the is [7] !!!!!!
print rs.result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment