Knowledge organisersProgramming Fundamentals
+ - * / MOD DIV ^
Arithmetic operators are the basic mathematical operations used in programming to process numerical data. You need to know addition, subtraction, multiplication, division, exponentiation, integer division (DIV/quotient), and modulus (MOD/remainder). DIV and MOD are particularly useful in programming for tasks like checking odd/even numbers.
+ Addition, - Subtraction, * Multiplication, / Division (returns a decimal).% in Python) returns the remainder of a division, e.g. 7 MOD 2 = 1.// in Python) returns the integer quotient of a division, e.g. 7 DIV 2 = 3.^ Exponentiation (** in Python) raises a number to a power, e.g. 12^2 = 144.number MOD 2 == 0 means even, remainder 1 means odd.hours = totalMinutes DIV 60, mins = totalMinutes MOD 60.score = score + 1 (or score += 1 or score++). Note: score =+1 is WRONG — it assigns positive 1, overwriting the value. Also: score + 1 alone does NOT change score.print(12 __ 2) for exponentiation → ^ or **.* means multiplication, / means division. DIV is integer/floor division (no remainder). You may be asked to state the PURPOSE of each operator.a = 17
b = 5
print(a + b) # 22 (addition)
print(a - b) # 12 (subtraction)
print(a * b) # 85 (multiplication)
print(a / b) # 3.4 (real division)
print(a // b) # 3 (DIV / quotient)
print(a % b) # 2 (MOD / remainder)
print(a ** 2) # 289 (exponentiation)