Codele / Programming basics
Doing maths
Computers are brilliant at sums. Here are the signs they use, the order they work in, and a way to find what is left over when you share sweets.
- The signs are + (add), - (subtract), the star (multiply) and / (divide).
- Multiply and divide happen before add and subtract. So 2 + 3 times 4 is 14, not 20.
- Brackets go first. They let you choose the order yourself.
- The remainder is what is left over after sharing equally. The percent sign finds it.
- Dividing whole numbers in Python needs two slashes to keep the whole part. Most other languages do it with one.
Loading the playable lesson…