Module 3: Operators in Python
Arithmetic Operators
Arithmetic operators let you do math in Python — add, subtract, multiply, divide, and more. You use them every day in data science for calculations.
About 10 minutes
Basic math operators
- + addition
- - subtraction
- * multiplication
- / division (always gives float)
- // floor division (whole number part)
- % modulo (remainder)
- ** power (exponent)
Example code
print(10 + 3) # 13 print(10 - 3) # 7 print(10 * 3) # 30 print(10 / 3) # 3.333... print(10 // 3) # 3 print(10 % 3) # 1 print(2 ** 4) # 16
10 / 3
3.333... (float)
10 // 3
3 (drops decimals)
Practice
Calculate the area of a rectangle: width 7, height 4. Print the result.
Key takeaways
- Use +, -, *, / for everyday math.
- / gives a float; // gives whole-number division.
- % is remainder; ** is power.
Quick check: Arithmetic Operators
Question 1 of 2
What is 10 // 3 in Python?