Skip to content

Instantly share code, notes, and snippets.

@stephengruppetta
Last active May 15, 2023 22:15
Show Gist options
  • Save stephengruppetta/60d34dc031aa315a995f9fec362d3f41 to your computer and use it in GitHub Desktop.
Save stephengruppetta/60d34dc031aa315a995f9fec362d3f41 to your computer and use it in GitHub Desktop.
# hogwarts_magic.py
class Wizard:
# ...
class House:
def __init__(self, name, founder, colours, animal):
self.name = name
self.founder = founder
self.colours = colours
self.animal = animal
self.members = []
self.points = 0
def add_member(self, member):
self.members.append(member)
def remove_member(self, member):
self.members.remove(member)
def update_points(self, points):
self.points += points
def get_house_details(self):
return {
"name": self.name,
"founder": self.founder,
"colours": self.colours,
"animal": self.animal,
"points": self.points
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment