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.
In this lesson, we also review the use of AI and LLM (e.g., ChatGPT) in generating code and discuss the pros and cons. 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
Describe the pros and cons of using AI and LLM in generating code
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 & Kamyar Hasanzadeh, University of Helsinki @ Geo-Python channel on Youtube.
Lesson 4.2 - Coding with ChatGPT, script files and modules
Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ Geo-Python channel on Youtube.