2024-heraklion-ODD/exercises/Exercise 2a Local imports.md
2024-08-23 19:17:28 +02:00

1 KiB

Exercise 2a: Local importing

Goal

Retrival practice in "basic" importing.

Preparation

(none)

Tasks

  1. Create a file in the src/ folder called make_potion.py and copy the code below into it.
# ADD IMPORT STATEMENTS HERE!


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)
  1. Figure out what import statements are missing, either by visual inspection or by running the code and seeing what dies. Add the missing import statements at the top of the file. You may need to inspect the files in src/brewing/.

  2. Run make_potion.py. Did it work?