

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Variables
incomplete
2: Variables Vary
incomplete
3: Math
incomplete
4: Negative Numbers
incomplete
5: Comments
incomplete
6: Variable Names
incomplete
7: Basic Variable Types
incomplete
8: F-Strings in Python
incomplete
9: NoneType Variables
incomplete
10: NoneType Quiz
incomplete
11: Dynamic Typing
incomplete
12: Math With Strings
incomplete
13: Multi-Variable Declaration
incomplete
14: Boots
incomplete
15: Spellbook
incomplete
16: Character Report
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
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.
my_sum = a + b
my_difference = x - y
my_product = c * d
my_quotient = a / b
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.
Create a new variable called armored_health on line 3 and set it equal to player_health multiplied by armor_multiplier.