-
-
Save stephengruppetta/cc8d275542385e5099535f796bd5128a 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment