-
-
Save stephengruppetta/224d84590ac37be1b72ba967703c05d2 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 Student | |
from schools import Hogwarts | |
hogwarts = Hogwarts() | |
harry = Student("Harry Potter", "stag", 1980) | |
hermione = Student("Hermione Granger", "otter", 1979) | |
ron = Student("Ron Weasley", "jack russell terrier", 1980) | |
harry.assign_house_using_sorting_hat(hogwarts) | |
print(harry.house) | |
# Gryffindor | |
hermione.assign_house_using_sorting_hat(hogwarts) | |
print(hermione.house) | |
# Gryffindor | |
ron.assign_house_using_sorting_hat(hogwarts) | |
print(ron.house) | |
# Gryffindor | |
# A few checks… | |
print(harry.house.members) | |
# [ | |
# Student('Harry Potter', 'stag', 1980), | |
# Student('Hermione Granger', 'otter', 1979), | |
# Student('Ron Weasley', 'jack russell terrier', 1980) | |
# ] | |
print(harry.house is ron.house) | |
# True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment