2024-heraklion-ODD/exercises/Exercise 2b Unprotected code.md

27 lines
662 B
Markdown
Raw Normal View History

2024-08-23 09:10:39 +02:00
## Exercise 2a: Unprotected code
#### Goal
Investigate what happens when importing from modules with "unprotected" code.
#### Preparation
(none)
#### Tasks
0. Create a file in the `src/` folder called `main.py`.
1. Add a line in `main.py` that imports the `make_example_potion` function from
`make_potion.py`.
2. **BEFORE YOU EXECUTE THE FILE**. Discuss with your partner what you think will
happen when you run `main.py`.
3. Run `main.py`. Does your prediction match reality?
4. (optional, for those who know) Discuss with your partner:
* Why did this behaviour occur?
* Why is it not good?
* What can you do to "fix" the behaviour?