-
-
Save stephengruppetta/ec20855ea22533ca6c0e43b341faf1ea 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
# making_magic.py | |
from hogwarts_magic import Wizard, House | |
harry = Wizard("Harry Potter", "stag", 1980) | |
hermione = Wizard("Hermione Granger", "otter", 1979) | |
gryffindor = House( | |
"Gryffindor", | |
"Godric Gryffindor", | |
["scarlet", "gold"], | |
"lion", | |
) | |
print(harry.name) | |
# Harry Potter | |
print(harry.house) | |
# None | |
print(gryffindor.members) | |
# [] | |
harry.assign_house(gryffindor) | |
print(harry.house.name) | |
# Gryffindor | |
for member in gryffindor.members: | |
print(member.name) | |
# Harry Potter | |
gryffindor.add_member(harry) | |
for member in gryffindor.members: | |
print(member.name) | |
# Harry Potter | |
# Harry Potter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment