Lesson overview#

In this lesson we will learn how to create and use functions, one of the most powerful concepts in programming. A function (funktio) makes it easy to use and re-use of a part of a program. We will also introduce you to the concept of a module (moduuli) (also known as a library (ohjelmakirjasto) in other programming languages), which you can think of as a toolbox for a specific purpose. Each module contains specific functionalities (i.e., functions) that you can use for different tasks. Thus, functions and modules are closely related. The main components of today’s lesson can be found in the navigation bar to the left.

Learning goals#

After this weeks lesson your should be able to:

  • Explain how functions are used and their benefits

  • Create your own functions to calculate an output value based on an input value

  • Save functions to a script file for future use

Lesson videos#

Lesson 4.1 - Introduction to Functions

Dave Whipp & Christoph Fink, University of Helsinki @ Geo-Python channel on Youtube.

Lesson 4.2 - Namespaces, script files, and using modules

Dave Whipp & Christoph Fink, University of Helsinki @ Geo-Python channel on Youtube.