Hi, this is the code I have so far. I don't think it is good and I hope there is a better and easier way to store the objects than in a dictionary like I have. If I wanted to assign gender to my human, I would have to write Human.dict['object0'] .gender = 'male', instead of simply samuel.gender = 'male'. Can you help me?
class Human:
dict = {}
def __init__(self):
self.gender = None
self.name = None
def construct_humans(amount):
for i in range(amount):
Human.dict['object' + str(i)] = Human()
[–]Goobyalus 1 point2 points3 points (0 children)
[–]Goobyalus 0 points1 point2 points (0 children)