class person():
def __init__(self):
self.height = 3.0
self.weight = 240.0
self.temp = 99.23
self.statlist = [self.height, self.weight, self.temp]
def grow(self):
self.statlist[1] = self.statlist[1] + 26.0
What is the best way to approach this?
The problem is that I’m trying to access these ‘stat’ attributes from a list and alter them, but I really don’t know how to call them. I need to do this so I can randomly choose a stat to modify. Should I make a stat class, so that each stat is an instance of that class?
Any help would be magnificent.
1 Answer