Phase 1 — Core Foundations
Operators
Arithmetic, comparison, and logical operators — and, or, not instead of &&, ||, !
Arithmetic operators
a = 10
b = 3
print(a + b) # 13
print(a - b) # 7
print(a * b) # 30
print(a / b) # 3.3333333333333335Python has two operators JS/TS doesn't have directly:
Floor division — divides and rounds down to a whole number:
10 // 3 # 3Modulus — the remainder after division:
10 % 3 # 1Power — exponent:
2 ** 3 # 8Full list:
| Operator | Meaning |
|---|---|
+ | addition |
- | subtraction |
* | multiplication |
/ | division |
// | floor division |
% | remainder |
** | power |
Comparison operators
These should feel familiar:
a == b
a != b
a > b
a < b
a >= b
a <= bImportant: Python doesn't have a strict-equality operator like ===. There's only ==.
Logical operators
JS/TS uses symbols; Python uses words.
| JS/TS | Python |
|---|---|
&& | and |
|| | or |
! | not |
age >= 18 and is_active
is_admin or is_manager
not is_active