Estimated time needed: 10 minutes
After completing this lab you will be able to:
Expressions are the building blocks of Python computations.
# Basic arithmetic
100 + 60

You can perform arithmetic using operators like +
, -
, *
, /
, and //
.
# Subtraction
25 - 50
# Multiplication
-10 * 2.5
# Division
25 / 5
25 / 6
# Integer Division
25 // 6

You can assign values to variables using the assignment operator =
.
my_variable = 1
print(my_variable)
A variable's value can be changed by reassigning it.
x = 10
x = 5 + 3
y = x / 3
x = y

Check variable types using type()
and use meaningful variable names.
type(x)
total_min = 142
total_hour = total_min / 60
# Update input variable and see final result update
total_min = 200
total_hour = total_min / 60

