Exposing functions to users
Now that your impyrial
package has some useful code and is properly organized, it is time to use import structures to expose the functions to users.
Currently, the only function you want to make easily available to users is the convert_unit()
function inside the module impyrial/length/api.py
.
In this exercise, you'll write import statements so that the package can be imported and used like this:
import impyrial
result = impyrial.length.convert_unit(6, 'ft', 'yd')
Remember that you can open/close the folder and files overview by clicking on the icon on the left side of the editor highlighted in red.
Cet exercice fait partie du cours
Developing Python Packages
Exercice interactif pratique
Passez de la théorie à la pratique avec l’un de nos exercices interactifs
