Skip to content

Instantly share code, notes, and snippets.

@stephengruppetta
Created May 15, 2023 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephengruppetta/a445fd4997cbdf2e821871dec4f94052 to your computer and use it in GitHub Desktop.
Save stephengruppetta/a445fd4997cbdf2e821871dec4f94052 to your computer and use it in GitHub Desktop.
# hogwarts_magic.py
class Wizard:
def __init__(self, name, patronus, birth_year):
self.name = name
self.patronus = patronus
self.birth_year = birth_year
self.house = None
self.wand = None
def assign_wand(self, wand):
self.wand = wand
print(f"{self.name} has a {self.wand} wand.")
def assign_house(self, house):
self.house = house
house.add_member(self)
class House:
# ...
def add_member(self, member):
self.members.append(member)
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment