Operators
Source: 1-Python Basics/1.3-operators.ipynb
Start here — no coding background needed
What you will learn
Do math and compare values — greater than, equal to, etc.
In simple words
Use + - * / like a calculator. Use == to check equality and > < to compare. Result is often True or False.
Think of it like this
Shopping: total price, "is total over budget?", "is discount exactly 10?"
Words to know:
- == — Checks if two values are equal
- > — Checks if left side is bigger
Start here if you have never coded. We use everyday examples — no jargon without explanation.
Easy example — run this first. Change values and press Run again.
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Reference notes (from full bootcamp)
Optional — deeper detail for when you are ready
Deep Dive into Operators
Video Outline:
- Introduction to Operators
- Arithmetic Operators
- Addition
- Subtraction
- Multiplication
- Division
- Floor Division
- Modulus
- Exponentiation
- Comparison Operators
- Equal to
- Not equal to
- Greater than
- Less than
- Greater than or equal to
- Less than or equal to
- Logical Operators
- AND
- OR
- NOT
- Practical Examples and Common Errors
Expected (from notebook): 15 5 50 2.0 2 0 100000
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): 2.0
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): 4.2
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): 4
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Comparison Operators
Expected (from notebook): True
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): True
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): False
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): True
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): False
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): True
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): True
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): True
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Logical Operators
Expected (from notebook): True
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): False
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): False
Runs in your browser via Pyodide — no server. First run may take a few seconds.
Expected (from notebook): True
Runs in your browser via Pyodide — no server. First run may take a few seconds.
## Simple Calculator
# Simple calculator
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
# Performing arithmetic operations
addition = num1 + num2
subtraction = num1 - num2
multiplication = num1 * num2
division = num1 / num2
floor_division = num1 // num2
modulus = num1 % num2
exponentiation = num1 ** num2
# Displaying results
print("Addition:", addition)
print("Subtraction:", subtraction)
print("Multiplication:", multiplication)
print("Division:", division)
print("Floor Division:", floor_division)
print("Modulus:", modulus)
print("Exponentiation:", exponentiation)
Browser practice only — full example needs Python on your computer (files, Flask, threads, etc.).
Practice test — try yourself
Write code, press Check. Wrong answer shows the correct code to copy & run.
a=15, b=4. Print sum and product on separate lines (Sum: 19, Product: 60).