-
-
Save stephengruppetta/c711c389def72f24427bb0d95d97ae03 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, Wand, Professor, Student | |
harry = Student("Harry Potter", "stag", 1980, 1) | |
hermione = Student("Hermione Granger", "otter", 1979, 1) | |
gryffindor = House( | |
"Gryffindor", | |
"Godric Gryffindor", | |
["scarlet", "gold"], | |
"lion", | |
) | |
slytherin = House( | |
"Slytherin", | |
"Salazar Slytherin", | |
["green", "silver"], | |
"serpent" | |
) | |
snape = Professor("Severus Snape", "doe", 1960, "Potions") | |
snape.assign_wand(Wand("Holly", "Phoenix Feather", 10.5)) | |
# Severus Snape has a | |
# <hogwarts_magic.Wand object at 0x7fa915302220> wand. | |
snape.assign_house(slytherin) | |
mcgonagall = Professor( | |
"Minerva McGonagall", "cat", 1935, "Transfiguration" | |
) | |
mcgonagall.assign_wand(Wand("Hawthorn", "Unicorn Hair", 11)) | |
# Minerva McGonagall has a | |
# <hogwarts_magic.Wand object at 0x7fa9153021c0> wand. | |
mcgonagall.assign_house(gryffindor) | |
harry.assign_subjects(["Potions", "Transfiguration"]) | |
snape.assess_student(harry, 20) | |
# Severus Snape assessed Harry Potter in Potions. The grade is 20%. | |
snape.assess_student(hermione, 60) | |
# Hermione Granger doesn't study Potions. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment