Mathematical Operations with Numbers in Python
Python allows you to perform all the basic mathematical operations. Let's look at each of them below.
Addition:
test = 1 + 2
print(test) # 3
Subtraction:
test = 2 - 1
print(test) # 1
Multiplication:
test = 3 * 2
print(test) # 6
Division:
test = 4 / 2
print(test) # 2
Integer division:
test = 10 // 3
print(test) # 3
Print to the console the sum of three numbers 1, 2 and 3.
Let's say you have numbers 4 and 6. Subtract the first number from the second.
Find the product of the two numbers from the previous problem.
Let's say you have numbers 8 and 3. Divide the first number by the second.
Change the solution to the previous problem so that there is no remainder after division.