[Solved] A class inside of a class [closed]


Yes you can do that but it would be better if you make the Males and Females into different classes and just inherit from the Human class.

class Human:
    def __init__(self, height, weight):
        self.height = height
        self.weight = weight

class Male(Human):
    def __init__(self, name):
        Human.__init__(self, height, weight)  # This will inherit every attribute of the parent class.
        self.name = name

class Female(Human):
    ...some more code

solved A class inside of a class [closed]