This is just a quick post about maths in Python. Computer languages use slightly different symbols for mathematical operations. Here’s a few examples from Python 3.
The easiest way to see this working is to use the interpreter (the first window that opens up when you start Python – the one with >>>).
Adding and taking away are the same: just type: “1+1” and : “1-1” and you’ll see.
Multiplcation is done by the * symbol. Division by /. Try a few out!
There are some other nice division operators that might be new to you. // gives the integer division. So if you type 7//2 you should get the answer “3”. The other one is called “modulus”. This gives the remainder after division has happened, so 7%2 will return “1”.
There are also some shortcuts you can do. If you want to add a number to a variable and then put the answer back in the variable you can do it this way. Let’s say you have put the value 1 into a variable i (type in “i=1” and hit enter). Now type “i+=5” and press enter. If you now tell the interpreter to “print(i)”, it will give you the answer “6”. You can do this with the other operators I’ve mentioned also. Have a play! You might even want to write a simple program that does something like asking for some numbers, doing some sums with them, and then printing the results.