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:
pythontest = 1 + 2
print(test) # 3
Subtraction:
pythontest = 2 - 1
print(test) # 1
Multiplication:
pythontest = 3 * 2
print(test) # 6
Division:
pythontest = 4 / 2
print(test) # 2
Integer division:
pythontest = 10 // 3
print(test) # 3
Задание 1
Print to the console the sum of three numbers 1, 2 and 3.
Задание 2
Let's say you have numbers 4 and 6. Subtract the first number from the second.
Задание 3
Find the product of the two numbers from the previous problem.
Задание 4
Let's say you have numbers 8 and 3. Divide the first number by the second.
Задание 5
Change the solution to the previous problem so that there is no remainder after division.