🧮 Working with Maths

Using Maths in Programs

Now that we know how to create variables and update their values, we can start using them in calculations. Programs use maths constantly — especially in games. Damage, armour, speed, experience points, currency — all of these rely on mathematical operations.
Python uses simple symbols for common operations:
total = a + b      # addition
remaining = a - b  # subtraction
result = a * b     # multiplication
split = a / b      # division
These operators work with variables just like they do with numbers.
Assignment:

In World of Software Engineering, our hero equips powerful armour. The armour doubles their effective health. Create a new variable called: armored_health Set it equal to: player_health * armor_multiplier Then print the result.
Create armored_health
player_health = 1000
armor_multiplier = 2

# create armored_health here

print(armored_health)

← Previous Home Next →