Thuta Learning
BasicProgrammingbeginner

Python Numbers

Relax. We'll talk through this in plain words — no textbook voice.

🐍 Lesson 7: Python Numbers

1. What are numbers?

Short answer → Python mainly represents numbers using three data types.

In other words → In Python, numbers are mainly represented by three data types.

2. Number Types

  • int (Integer) → whole numbers (e.g. 10, -5, 1000)
  • float (Floating point) → decimal numbers (e.g. 3.14, -0.5)
  • complex → complex numbers (e.g. 2 + 3j)

3. Arithmetic Operators

Python uses the following operators for doing math with numbers.

Operatorအဓိပ္ပာယ်ဥပမာResult
+ပေါင်း5 + 38
-နုတ်5 - 32
*မကြိမ်5 * 315
/Division (ဒဿမနဲ့)5 / 22.5
//Floor Division (အနိမ့်ဆုံးကိန်းပြည့်)5 // 22
%Modulus (ကျန်ရှိ)5 % 21
**Exponentiation (အနိပ်)2 ** 38

4. Summary

✅ Python Numbers → int, float, complex

✅ Arithmetic operators → + - * / // % **

✅ Use casting and built-in functions to convert and compute with numbers

python
# ===== 1. Number Types =====
x = 10        # int
y = 3.14      # float
z = 2 + 3j    # complex

print(f"Int: {x}, Type: {type(x)}")
print(f"Float: {y}, Type: {type(y)}")
print(f"Complex: {z}, Type: {type(z)}")

# ===== 2. Arithmetic Operations =====
a = 7
b = 3

print(f"\n===== Arithmetic Operators =====")
print(f"{a} + {b} = {a + b}")   # Addition
print(f"{a} - {b} = {a - b}")   # Subtraction
print(f"{a} * {b} = {a * b}")   # Multiplication
print(f"{a} / {b} = {a / b}")   # Division
print(f"{a} // {b} = {a // b}") # Floor Division
print(f"{a} % {b} = {a % b}")   # Modulus
print(f"{a} ** {b} = {a ** b}") # Exponentiation

# ===== 3. Type Conversion =====
print(f"\n===== Type Conversion =====")
num = 5
print(f"int to float: {float(num)}")   # 5.0
print(f"float to int: {int(3.99)}")     # 3

# ===== 4. Useful Functions =====
print(f"\n===== Useful Functions =====")
print(f"abs(-10) = {abs(-10)}")          # Absolute value
print(f"pow(2, 4) = {pow(2, 4)}")         # Power
print(f"round(3.14159, 2) = {round(3.14159, 2)}")  # Rounding
You should see
Int: 10, Type: Float: 3.14, Type: Complex: (2+3j), Type: ===== Arithmetic Operators ===== 7 + 3 = 10 7 - 3 = 4 7 * 3 = 21 7 / 3 = 2.333... 7 // 3 = 2 7 % 3 = 1 7 ** 3 = 343 ===== Type Conversion ===== int to float: 5.0 float to int: 3 ===== Useful Functions ===== abs(-10) = 10 pow(2, 4) = 16 round(3.14159, 2) = 3.14
Python Numbers | Thuta Learning