Skip to content

Instantly share code, notes, and snippets.

@shreezan123
Created October 4, 2018 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shreezan123/57747d630f763332df5ce28ff3215e5d to your computer and use it in GitHub Desktop.
Save shreezan123/57747d630f763332df5ce28ff3215e5d to your computer and use it in GitHub Desktop.
class Incrementor:
array = []
value = 0
arrayVals = []
def __init__(self,array):
self.array = array
def add_value(self,value):
self.value = value
def add_values(self,valuesArr):
self.arrayVals = valuesArr
def increment_values(self):
for i in range(len(self.arrayVals)):
self.arrayVals[i] += 1
def get_values(self):
return self.arrayVals
inc = Incrementor([1,2,3])
inc.add_value(10)
inc.add_values([1,2,3,4,5])
inc.increment_values()
print inc.get_values()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment