We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Math

Now that we know how to store and change the value of variables let's do some math! Here are examples of common mathematical operators using Python syntax.

Addition

my_sum = a + b

Subtraction

my_difference = x - y

Multiplication

my_product = c * d

Division

my_quotient = a / b

Order of Operations

Parentheses can be used to order math operations:

first = 5
second = 7
third = 9
average_value = (first + second + third) / 3
print(average_value)

Which prints 7, the average of 5, 7, and 9.

Assignment

Create a new variable called armored_health on line 3 and set it equal to player_health multiplied by armor_multiplier.