Skip to content

Instantly share code, notes, and snippets.

@stephengruppetta
Created May 15, 2023 19:32
Show Gist options
  • Save stephengruppetta/19976f1524f59524cba2eda6bc047da8 to your computer and use it in GitHub Desktop.
Save stephengruppetta/19976f1524f59524cba2eda6bc047da8 to your computer and use it in GitHub Desktop.
# making_magic.py
from hogwarts_magic import Wizard
harry = Wizard("Harry Potter", "stag", 1980)
hermione = Wizard("Hermione Granger", "otter", 1979)
print(harry.name)
# Harry Potter
print(harry.wand)
# None
print(hermione.name)
# Hermione Granger
print(hermione.wand)
# None
harry.assign_wand("holly, phoenix feather, 11 inches")
# Harry Potter has been assigned the holly,
# phoenix feather, 11 inches wand.
hermione.assign_wand("vine, dragon heartstring, 10 1/2 inches")
# Hermione Granger has been assigned the vine,
# dragon heartstring, 10 1/2 inches wand.
print(harry.wand)
# holly, phoenix feather, 11 inches
print(hermione.wand)
# vine, dragon heartstring, 10 1/2 inches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment