Day 3 — Arithmetic Operators

Python Starter Club • Programmer’s Picnic • Champak Roy

Python follows a fixed order while calculating. Today we will learn operators and see every step clearly.

Calm rule: You don’t need to memorize. You only need to understand the order once.

Comic Visual memory anchor

🎨 Day 3 Comic — Operators + BODMAS

This comic makes the “order of operations” feel natural. (Place your generated image as 0.png.)

Day 3 Comic: Arithmetic Operators and BODMAS
Explanation Read once, then practice

🧠 What are arithmetic operators?

Operators are the symbols Python uses to do calculations. You have already used + in math. Python has a few more.

  • + adds numbers
  • - subtracts numbers
  • * multiplies numbers
  • / divides and gives a decimal (float)
  • // divides and removes the decimal part (floor division)
  • % gives the remainder (useful in “even/odd” later)
  • ** power (2**3 = 8)

📊 Arithmetic Operators in Python

This table shows what each operator does and when Python evaluates it. You do not need to memorize this — use it for reference.

Operator Meaning Example Result Precedence
() Brackets (grouping) (2 + 3) * 4 20 Highest
** Power 2 ** 3 8 High
* Multiplication 6 * 4 24 Medium
/ Division (decimal) 7 / 2 3.5 Medium
// Floor division 7 // 2 3 Medium
% Remainder 7 % 2 1 Medium
+ Addition 5 + 3 8 Low
- Subtraction 5 - 3 2 Low

Python always evaluates higher precedence first. If two operators have the same precedence, Python goes left to right.

✅ Mini examples

print(10 + 5)   # 15
print(10 - 5)   # 5
print(10 * 5)   # 50
print(10 / 5)   # 2.0  (always float)

print(10 // 3)  # 3
print(10 % 3)   # 1
print(2 ** 3)   # 8

🍲 BODMAS in one human story

Think of making batti–chokha. You must do steps in order: mesh flour first, then mix, then roast, then mash, and ghee comes last. If you change the order, the result becomes messy.

Python is a strict robot. It follows a safe order so everyone gets the same answer.

✅ Python’s order (simple version)

  • ( ) brackets first
  • ** power
  • * / // % multiply/divide family
  • + - add/subtract last

✅ Same numbers, different meaning

print(1 + 2 * 3)     # 7  (2*3 first)
print((1 + 2) * 3)   # 9  (brackets force priority)
📝 Day 3 Task

Take two numbers from the user and print Addition, Subtraction, Multiplication using f"".

Operators Type yourself

➕➖✖➗ Operators

a = 10
b = 5

print(a + b)  # addition
print(a - b)  # subtraction
print(a * b)  # multiplication
print(a / b)  # division (float)

⭐ Special operators

print(10 // 3)   # floor division -> 3
print(10 % 3)    # remainder -> 1
print(2 ** 3)    # power -> 8

Note: / always gives a decimal result. // removes the decimal part.

⌨️ Input + int()

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

print(f"Addition = {a + b}")
print(f"Subtraction = {a - b}")
print(f"Multiplication = {a * b}")

🧠 Order of operations

print(10 + 2 * 3)     # 16
print((10 + 2) * 3)   # 36
Interactive See every step

🧮 Expression Evaluator

Try: 6+7*4/2, 1+2*3, 2**3 + 10//3

Click Build Steps.

📋 All Steps

Steps will appear here…

This evaluator is designed for beginners: numbers + operators. Keep it simple and clear.

Pyodide Run Python in browser

🐍 Python Editor (Run)

This runs Python directly in the page using Pyodide. First run may take a few seconds. Input will appear as browser prompts.

Pyodide not loaded yet.
Output will appear here…