Introduction to Wagtail | Coders of Colour

Functions and Variables

Functions

A function is a set of instructions that we can call with a name. This set of instructions is reusable.

print()
def say_hello()

Variables

A variable is a virtual box in which we put data.

age = 43

In Python, a variable is typed. This means a variable (or the 'virtual box') does not only contain the value, but also the type of the variable.

Here are some variable types:

  • Integers or whole numbers: a number without decimales.
  • Floats or numbers with decimales : for example : 1.5
  • Strings : Characters between inverted commas - "Hello, World!".
  • Lists : that we will see very soon :).

There are several other types, but we these will suffice for now.

Edit this page on GitHub

On this page