Introduction to Wagtail | Coders of Colour

The console and the file

When coding in Python, there are two areas we can code in: the console and the file.

The file

Most of the time, we code in the file.

  • When we 'run' the file, we run all of the lines from top to bottom.
  • The output is only visible with a print() statement
  • We use files for code that we will run several times.

The console

The console shows the output of your progeam (the code in the file). You can also code directly into the console!

The console:

  • Runs each time onve it is written (after you press Enter)
  • Shows the output of each lines
  • Is interactive and used for exploration

Maths

We can some some simple calculations directly in the console:

  • 2 + 3
  • 2 - 4

In programming, the division sign is / and the multiplication sign is *. So:

  • 2 * 4 = 8
  • 10 / 2 = 5
Edit this page on GitHub