Warning: This document is for the development version of Geo-Python. The main version is master.

Lesson overview

In this lesson we will learn how to create and use functions, one of the most powerful concepts in programming. We will also introduce you to the concept of a module (also known as a library 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.

  1. Basic concepts of functions
  2. Loading and using modules
  3. Writing scripts the “right” way
  4. Exercise 4: Classifying and converting temperatures

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

Lecture

Lecture

Lesson 4 - Functions and libraries

Dave Whipp & Vuokko Heikinheimo, University of Helsinki @ Geo-Python channel on Youtube.