Variables and types
A variable is a name that refers to a value. You create one with =:
score = 42 # int (whole number)
price = 9.99 # float (decimal number)
name = "Ada" # str (text)
is_admin = False # bool (True / False)
Python figures out the type for you. Use type(x) to inspect it.
Numbers support the usual maths: + - * / and also // (integer division), % (remainder) and ** (power).
f-strings
To mix values into text, put an f before the quotes and wrap expressions in braces:
print(f"{name} scored {score} points")
Try it
Using the variables provided, print the area and perimeter of the rectangle exactly like this:
Area: 21
Perimeter: 20