The following page contains a basic introduction to coding with Python. If you feel confident with core Python concepts, feel free to have a quick look through and then move to the next page on Python on the Raspberry Pi.

Python - On the Raspberry Pi

Python - What is it?

“What's a coder's favourite animal? The Python”


Variables

var1 = 1 # Store the integer one in var1
var2 = 1.1 # Store the float value in var2
var3 = "Hello World" # Store the phrase "Hello World" in var3
var4 = True

Operators

“When they are a (54 - 2)/(2^2) - 3 😍”

var = 1 + 2 # Addition
var = "Hello " + "world" # Creates "Hello world"
var = 20 - 10 # Subtraction
var = 5 * 6 # Multiplication
var = 10 / 2 # Division
var = 7 % 3 # Division Remainder (e.g. 3 % 2 = 1)
var = 4 ** 2 # Expoent (e.g 4 to the power of 2 = 16)