Given an arbitrary number of people:
def __init__(self):
self.person1 = ["Person_1", 0]
self.person2 = ["Person_2", 0]
...
I would like to adjust the value "0" to "25".
How can I change the variable during each iteration so that I don't have to type it as follows:
def daily_income(self):
self.person1[1] += 25
self.person2[1] += 25
...
I tried to adjust the variable name by appending the "i" to the end of the variable name, however, it did not work.
def daily_income(self):
for i in range(1,3):
'self.person_{}'.format(i)[1] += 25
self.peoplestructure this problem wouldn't exist.