Core Operators
Python uses the standard arithmetic operators:
+addition-subtraction*multiplication/division (returns a float)
print(89 + 47)
print(89 - 47)
print(89 * 47)
print(89 / 47)
Remember: use * (asterisk) for multiply and / (forward slash) for divide.
User-Friendly Output
Combine text with answers so results are easy to read:
print("53 x 7 =", 53 * 7) # commas add spaces automatically
This prints: 53 x 7 = 371
Using Variables in Calculations
Store numbers in variables and calculate with them:
num1 = 12
num2 = 20
total = num1 * num2
print("The total is", total)
Using User Input
Let the user supply numbers (convert text input with int()):
num1 = int(input("Enter number one: "))
num2 = int(input("Enter number two: "))
answer = num1 - num2
print(num1, "-", num2, "=", answer)
Simple Calculations Task 1 – +, -, *, ÷
Write four separate calculations—one using each operator—and display a clear message for each. (Tip: copy the divide symbol: ÷)
print("18 + 35 =", 18 + 35)
print("18 - 35 =", 18 - 35)
print("18 x 35 =", 18 * 35)
print("18 ÷ 35 =", 18 / 35)
Simple Calculations Task 2 – Divide by 3
Ask the user to enter a number, divide it by 3, and print the result.
number = int(input("Enter a number: "))
print(number, "divided by 3 is", number / 3)
Simple Calculations Task 3 – Add 3 Numbers
Prompt the user for three numbers, add them up, and print the total.
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
num3 = int(input("Enter the third number: "))
total = num1 + num2 + num3
print("The total is", total)