Functions and libraries
Duration5hPresentation & objectives
The objective of session 2 is to study an unmissable programming concept: functions. We will guide you through important programming concepts such as functions definition and usage, visibility and scope of variables, reuse of libraries, and code organization. We will also discuss the Python package manager, which can be used to install a lot of already existing libraries.
During the practical session, in addition to a few exercises on these notions, you will work on a small machine learning-related project. This will teach you how to properly organize your files, and write adapted functions.
Before the class
Technical requirements
To be able to start working on the activity, you should meet the following requirements:
- Please bring your own computer.
- Make sure to have a functional network connection.
During the class
Knowledge acquisition
To be able to start the practical activity efficiently, we will introduce some needed concepts at the beginning of the class. To save you some time, we will present you a few slides, that you can find hereafter:
These slides only cover the main elements of the course, and many more details are given in the associated articles. Thus, you should study the following articles at home after the session:
- Functions in a programming language.
- Organizing codes in libraries.
- Installing Python modules.
- Variables visibility and scope.
You can verify your understanding of these articles here:
Practical activity
The rest of the class is dedicated to a practical activity. When ready, click on the link below to start:
After the class
Complete the current session
Before the next session, you should:
- Review the contents of the articles above.
- Complete the non-optional parts of the practical activity.
Prepare the next session
Also, you should:
- Check the “Before the class” section of the next session, and make sure you do everything required to prepare it.
- The next session will start with an evaluated exercise, that puts in practice your understanding of Programming sessions 1 and 2.