Solution to exercise 3 #4

Open
emiliaja wants to merge 3 commits from emiliaja/2024-heraklion-ODD:python_expert into main
Showing only changes of commit 5430f47414 - Show all commits

View file

@ -2,6 +2,7 @@ from brewing import potion_class
from brewing import containers from brewing import containers
from brewing import cooking from brewing import cooking
from brewing import inspection from brewing import inspection
from brewing import ingredients
def make_example_potion(student_name="ASPP student"): def make_example_potion(student_name="ASPP student"):
"""Make and return an example potion.""" """Make and return an example potion."""
@ -16,12 +17,18 @@ def make_example_potion(student_name="ASPP student"):
def make_python_expert_potion(student_name): def make_python_expert_potion(student_name):
print("I am a Python Expert") print("I am a Python Expert")
# todo: write this function! python_expert = potion_class.Potion(student_name=student_name)
return # 1. Set up a pewter cauldron and light a fire underneath it
python_expert.setup(container=containers.PEWTER_CAULDRON, heat_source=cooking.BREATHE_ON_CAULDRON)
# 2. Add fish eyes, unicorn hair and tea leaves
python_expert.add_ingredients(ingredients=[ingredients.FISH_EYES, ingredients.UNICORN_HAIR, ingredients.TEA_LEAVES])
# 3. Let simmer for 2 hours
cooking.simmer(python_expert, duration=2)
return python_expert
if __name__ == "__main__": if __name__ == "__main__":
my_name = 'ASPP student' my_name = 'ASPP student'
my_potion = make_example_potion(student_name=my_name) my_potion = make_python_expert_potion(student_name=my_name)
# Let Snoope inspect the potion # Let Snoope inspect the potion
inspection.inspection_by_snoope(potion=my_potion, target_potion='example_potion') inspection.inspection_by_snoope(potion=my_potion, target_potion='python_expert')