From 73475c95d563316aedd5ea964ff09f08c4b80486 Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Mon, 26 Aug 2024 16:59:54 +0300 Subject: [PATCH 1/3] import dependecies from brewing --- src/make_potion.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/make_potion.py diff --git a/src/make_potion.py b/src/make_potion.py new file mode 100644 index 0000000..8369ce6 --- /dev/null +++ b/src/make_potion.py @@ -0,0 +1,18 @@ + +from brewing import potion_class +from brewing import cooking +from brewing import containers + + +def make_example_potion(student_name="ASPP student"): + my_potion = potion_class.Potion(student_name=student_name) + # Set up your old kettle and light an eternal flame underneath it. + my_potion.setup(container=containers.OLD_KETTLE, heat_source="eternal_flame") + # Simmer for 5 hours. + cooking.simmer(my_potion, duration=5) + print(f"You successfully ran make_example_potion, {student_name}, well done :).") + return my_potion + + +my_name = 'ASPP student' +my_potion = make_example_potion(student_name=my_name) \ No newline at end of file -- 2.39.5 From 618d44120950b9a70f87994b028b88bfe9bd843f Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Mon, 26 Aug 2024 17:12:33 +0300 Subject: [PATCH 2/3] protect code --- src/make_potion.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/make_potion.py b/src/make_potion.py index 8369ce6..cf5403b 100644 --- a/src/make_potion.py +++ b/src/make_potion.py @@ -13,6 +13,6 @@ def make_example_potion(student_name="ASPP student"): print(f"You successfully ran make_example_potion, {student_name}, well done :).") return my_potion - -my_name = 'ASPP student' -my_potion = make_example_potion(student_name=my_name) \ No newline at end of file +if __name__=="__main__": + my_name = 'ASPP student' + my_potion = make_example_potion(student_name=my_name) \ No newline at end of file -- 2.39.5 From 5430f4741495675be2d8e742e64bc6c540d347f8 Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Mon, 26 Aug 2024 18:15:15 +0300 Subject: [PATCH 3/3] complete exercise 3 with a different heat source because we are afraid of fire --- src/brewing/brew_potions.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/brewing/brew_potions.py b/src/brewing/brew_potions.py index b616a01..f799c80 100644 --- a/src/brewing/brew_potions.py +++ b/src/brewing/brew_potions.py @@ -2,6 +2,7 @@ from brewing import potion_class from brewing import containers from brewing import cooking from brewing import inspection +from brewing import ingredients def make_example_potion(student_name="ASPP student"): """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): print("I am a Python Expert") - # todo: write this function! - return + python_expert = potion_class.Potion(student_name=student_name) +# 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__": 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 - inspection.inspection_by_snoope(potion=my_potion, target_potion='example_potion') + inspection.inspection_by_snoope(potion=my_potion, target_potion='python_expert') -- 2.39.5