Python Arithmetic Operators

1. What are Arithmetic Operators?

Arithmetic operators are used to do math calculations in Python.

We use them to:

  • Add numbers

  • Subtract numbers

  • Multiply numbers

  • Divide numbers

2. List of Arithmetic Operators

Operator Name Example
+ Addition a + b
- Subtraction a - b
* Multiplication a * b
/ Division a / b
% Modulus a % b
** Power a ** b
// Floor Division a // b

3. Addition (+)

Adds two numbers.

Example

a = 10
b = 5
print(a + b)

Output:

15

4. Subtraction (-)

Subtracts one number from another.

Example

print(a - b)

Output:

5

5. Multiplication (*)

Multiplies two numbers.

Example

print(a * b)

Output:

50

6. Division (/)

Divides one number by another.
Result is always decimal (float).

Example

print(a / b)

Output:

2.0

7. Modulus (%) – Remainder

Gives the remainder.

Example

print(10 % 3)

Output:

1

Used to:

  • Check even or odd

num = 8
print(num % 2)

8. Power (**)

Raises number to a power.

Example

print(2 ** 3)

Output:

8

9. Floor Division (//)

Divides and removes decimal part.

Example

print(10 // 3)

Output:

3

10. Arithmetic Operators with Variables

Example

x = 20
y = 6

print(x + y)
print(x - y)
print(x * y)
print(x / y)

11. Arithmetic Operators with User Input

Example

a = int(input("Enter first number: "))
b = int(input("Enter second number: "))

print("Add:", a + b)
print("Subtract:", a - b)
print("Multiply:", a * b)
print("Divide:", a / b)

12. Common Beginner Mistakes

❌ Forgetting Type Conversion

a = input("Enter number: ")
print(a + 5)

✔ Correct:

a = int(input("Enter number: "))
print(a + 5)

❌ Confusing / and //

print(5 / 2) # 2.5
print(5 // 2) # 2

13. Simple Practice Examples

Example 1: Simple Calculator

a = 15
b = 4

print("Sum:", a + b)
print("Difference:", a - b)
print("Product:", a * b)
print("Quotient:", a / b)

Example 2: Square and Cube

num = 3
print("Square:", num ** 2)
print("Cube:", num ** 3)

Example 3: Even or Odd

num = 7

if num % 2 == 0:
print("Even")
else:
print("Odd")

14. Summary (Arithmetic Operators)

✔ Used for math
+ - * / are basic
% gives remainder
** gives power
// removes decimal

📘 Perfect for Beginner eBook

This chapter is ideal for:

  • Python beginner books

  • School & college students

  • Self-learners

If you want next, I can write:

  • Assignment Operators

  • Comparison Operators

  • Logical Operators

  • Arithmetic Exercises

  • MCQs with answers

Just tell me 😊

You may also like...