Created
April 7, 2022 08:05
-
-
Save timolesterhuis/169b6cb1d0566b98e4d1195b80d5579e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Tuple | |
class Person: | |
# class attribute | |
species = "Homo Sapiens" | |
# Instance attribute | |
def __init__(self, name: str, age: int) -> None: | |
self.name = name | |
self.age = age | |
# method | |
def says(self, text: str): | |
print(f"{self.name} says '{text}'") | |
def birthday(self): | |
self.age += 1 | |
print(f"{self.name} just had his/her birthday! he/she just turned {self.age}") | |
class InclusivePerson(Person): | |
def __init__(self, name: str, age: int, pronouns: Tuple[str, str]) -> None: | |
super().__init__(name, age) | |
self.pronouns = pronouns | |
def birthday(self): | |
self.age += 1 | |
print(f"{self.name} just had {self.pronouns[1]} birthday! {self.pronouns[0]} just turned {self.age}") | |
class Woman(InclusivePerson): | |
def __init__(self, name: str, age: int) -> None: | |
pronouns = ("she", "her") | |
super().__init__(name, age, pronouns) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment