Working with Numbers
Addition, Subtraction, Multiplication
# Examples of Adding, Subtracting, and Multiplying Values
x = 10
y = 11
z = 12
print(x + y) # 21 will be printed
print(x - z) # -2 will be printed
print(y * z) # 132 will be printed
result = (x * y) + z # the result variable will contain 122Division & Floor Division
# Examples of using both division and floor division
x = 10
y = 15
z = 3
print(x / z) # prints a floating point value of 3.3333333
print(x // z) # prints an integer value of 3
result1 = (y / z) # result1 contains a floating point value of 5.0
result2 = (y // z) # result2 contains an integer value of 5Modulus Operation
Last updated