Python for Kids

Arithmetic Operators in Python

1. What are Arithmetic Operators?

  • Arithmetic operators are symbols used to perform mathematical calculations in Python.
  • Python can work like a calculator using arithmetic operators.
  • We use these operators when working with:
    • Numbers
    • Scores
    • Prices
    • Calculations
    • Games
    • Real-life programs

Arithmetic operators help Python add, subtract, multiply, divide, and perform other math operations.

2. Addition Operator (+)

  • The addition operator is used to add two numbers.
  • Symbol used: +

Example:

print(5 + 3)

Output: 8

Using variables:

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

Output: 15

  • Addition is commonly used to:
    • Add scores
    • Add prices
    • Increase values

3. Subtraction Operator (-)

  • The subtraction operator is used to subtract one number from another.
  • Symbol used: -

Example:

print(10 - 4)

Output: 6

Using variables:

x = 20
y = 7
print(x - y)

Output: 13

  • Subtraction is useful when:
    • Reducing values
    • Checking remaining amount
    • Losing points in a game

4. Multiplication Operator (*)

  • The multiplication operator is used to multiply numbers.
  • Symbol used: * (asterisk)

Example:

print(4 * 5)

Output: 20

Using real-life example:

price = 3
quantity = 4
print(price * quantity)

Output: 12

  • Multiplication is used for:
    • Total cost
    • Repeated values
    • Calculating area

5. Division Operator (/)

  • The division operator divides one number by another.
  • Symbol used: /

Example:

print(10 / 2)

Output: 5.0

Important Note:

  • Even if both numbers are integers, Python gives the result as a float.

Example:

print(7 / 2)

Output: 3.5

  • Division is used for:
    • Splitting values
    • Finding averages
    • Sharing equally

6. Floor Division Operator (//)

  • Floor division divides numbers and removes the decimal part.
  • Symbol used: //

Example:

print(10 // 3)

Output: 3

Explanation: 10 ÷ 3 = 3.33. Floor division removes .33 and keeps only 3.

  • Floor division is useful when:
    • Counting full groups
    • Ignoring decimal values

7. Modulus Operator (%)

  • The modulus operator gives the remainder after division.
  • Symbol used: %

Example:

print(10 % 3)

Output: 1

Explanation: 10 ÷ 3 → remainder is 1

Common uses of modulus:

  • Checking even or odd numbers
  • Checking leftovers
  • Game logic

Example:

print(8 % 2)

Output: 0 (This means 8 is even)

8. Exponent Operator (**)

  • The exponent operator is used for power calculations.
  • Symbol used: **

Example:

print(2 ** 3)

Output: 8

Explanation: 2 × 2 × 2 = 8

More examples:

print(5 ** 2)  # Square
print(3 ** 3)  # Cube
  • Used for:
    • Squares
    • Cubes
    • Mathematical formulas

9. Using Arithmetic Operators with Variables

  • Arithmetic operators work very well with variables.

Example:

a = 10
b = 5
print(a + b)
print(a - b)
print(a * b)
print(a / b)

Python calculates values stored inside variables.

10. Summary of What Students Learned

  • What arithmetic operators are
  • Addition (+)
  • Subtraction (-)
  • Multiplication (*)
  • Division (/)
  • Floor division (//)
  • Modulus (%)
  • Exponent (**)
  • Using operators with numbers and variables

Arithmetic operators are very important and are used in almost every Python program.

11. Task for Students

Create a simple calculator program that:

  • Takes two numbers from the user
  • Performs:
    • Addition
    • Subtraction
    • Multiplication
    • Division
  • Prints all results

Optional Challenge:

  • Check if a number is even or odd using %