Aan de slagGa gratis aan de slag

Relative imports

To improve the structure of the calculator code base, you decide to organize your project by collecting the calculators in their own package.

Expand the calculators folder. You see the folder contains three files: an __init__.py file, which indicates that this folder is a package, and a file for each of the calculators, basic_calculator.py and financial_calculator.py.

The financial_calculator.py file needs to see the code from the basic_calculator.py file. To achieve this, use a relative import.

Deze oefening maakt deel uit van de cursus

Case Study: Building Software in Python

Cursus bekijken

Praktische interactieve oefening

Zet theorie om in actie met een van onze interactieve oefeningen.

Begin met trainen