ZIP indir
0
main
1 dal
git@carbon4code.com:ahmet/Python-for-Data-Science.git
Ahmet Kerem Piscine Final
10 commit
DiamondTrap.py 1.7 KB
from S1E7 import Baratheon, Lannister


class King(Baratheon, Lannister):
    """Representing the false king, born of a diamond inheritance."""

    def __init__(self, first_name: str, is_alive: bool = True) -> None:
        """Build a King from a first name and a health state."""
        super().__init__(first_name, is_alive)

    @property
    def eyes(self) -> str:
        """Return the eyes color of the king."""
        return self.__dict__["eyes"]

    @eyes.setter
    def eyes(self, value: str) -> None:
        """Set the eyes color of the king."""
        self.__dict__["eyes"] = value

    @property
    def hairs(self) -> str:
        """Return the hairs color of the king."""
        return self.__dict__["hairs"]

    @hairs.setter
    def hairs(self, value: str) -> None:
        """Set the hairs color of the king."""
        self.__dict__["hairs"] = value

    def get_eyes(self) -> str:
        """Return the eyes color through the property."""
        return self.eyes

    def set_eyes(self, value: str) -> None:
        """Change the eyes color through the property."""
        self.eyes = value

    def get_hairs(self) -> str:
        """Return the hairs color through the property."""
        return self.hairs

    def set_hairs(self, value: str) -> None:
        """Change the hairs color through the property."""
        self.hairs = value


def main() -> None:
    """Test the properties of the false king."""
    Joffrey = King("Joffrey")
    print(Joffrey.__dict__)
    Joffrey.set_eyes("blue")
    Joffrey.set_hairs("light")
    print(Joffrey.get_eyes())
    print(Joffrey.get_hairs())
    print(Joffrey.__dict__)
    print("---")
    print(King.__mro__)


if __name__ == "__main__":
    main()