e-learning

Python - Functions

Abstract

Functions are the basic unit of all work in Python! Absolutely everything you do uses functions. Conceptually, functions are super simple. Just like in maths, they take an input, do some transformation, and return an output. As an example, f(x) = x + 2 is a function that calculates whatever value you request, plus two. But functions are foundational, so, you should understand them well before moving on.

About This Material

This is a Hands-on Tutorial from the GTN which is usable either for individual self-study, or as a teaching material in a classroom.

Questions this will address

  • How do I write functions in Python?
  • What is a function?
  • What do they look like?
  • Fill in the missing part of a function

Learning Objectives

  • Understand the structure of a "function" in order to be able to construct their own functions and predict which functions will not work.

Licence: Creative Commons Attribution 4.0 International

Keywords: Foundations of Data Science, jupyter-notebook

Target audience: Students

Resource type: e-learning

Version: 4

Status: Active

Prerequisites:

Python - Math

Learning objectives:

  • Understand the structure of a "function" in order to be able to construct their own functions and predict which functions will not work.

Date modified: 2023-02-13

Date published: 2022-04-25

Authors: Bazante Sanders, Donny Vrins, Helena Rasche, The Carpentries

Contributors: Bazante Sanders, Donny Vrins, Helena Rasche, The Carpentries

Scientific topics: Software engineering


Activity log