colidescope

/guides/ 06-functions-and-classes-00-intro

Welcome! You are not currently logged in. You can Log in or Sign up for an account.

Functions and Classes

This series will build on your Python knowledge by introducing the concept of functions and classes

Introduction

In this module, we will learn how to package code in custom Functions so it is easily reusable throughout our code.

So far, we have seen how we can use Variables in Python to store different kinds of data, and how we can use 'flow control' structures such as Conditionals and Loops to change the order or the way in which lines of code get executed. With only these tools we can already start to express some pretty complex logics. However, with only our current tools, any sufficiently complex script would start to get very long, since every time we wanted to do a certain process we would have to rewrite all of its code.

This is where Functions come in. Functions allow us to encapsulate lines of code to create custom processes that can be reused anywhere throughout the script.

Sections in this guide

Functions and Classes
1Functions
2Classes