Thuta Learning
ရှာဖွေရန်
BasicProgrammingbeginner

Python Data Types

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

Python Data Types Visual Guide
Basic data types နဲ့ variable value တွေကို visual card ပုံစံနဲ့ရှင်းပြထားပါတယ်။

🐍 Lesson 6: Python Data Types (ဒေတာအမျိုးအစားများ)

1. Data Type ဆိုတာဘာလဲ?

မြန်မာ → Data Type ဆိုတာ Variable ထဲမှာ သိမ်းထားတဲ့ တန်ဖိုး (value) ရဲ့ အမျိုးအစားကို ဆိုလိုတယ်။

English → A data type defines the kind of value a variable holds.

2. Python ရဲ့ အဓိက Data Types

Data Typeအမည် (မြန်မာ)ဥပမာ
int (Integer)ကိန်းပြည့်age = 25
float (Floating point)ဒဿမကိန်းpi = 3.14
str (String)စာသားname = "Sai"
bool (Boolean)အမှန်/အမှားis_active = True

3. Collection Types (အစုအဝေး Data Types)

Data Typeအမည် (မြန်မာ)Properties
listစာရင်းordered, changeable
tupleမပြောင်းလဲနိုင်တဲ့ စာရင်းordered, unchangeable
setထပ်မရှိတဲ့ အစုunordered, no duplicates
dict (Dictionary)Key-Value စုံkey-value pairs, changeable

4. Data Type ကို စစ်ဖို့

  • type() → Variable ရဲ့ data type ကို ပြတယ်
  • isinstance() → Variable တစ်ခုက data type တစ်ခုနဲ့ ကိုက်မကိုက် စစ်နိုင်တယ်

5. အကျဉ်းချုပ်

✅ Data Type = Variable ထဲက တန်ဖိုးရဲ့ အမျိုးအစား

✅ အခြေခံ → int, float, str, bool

✅ Collection → list, tuple, set, dict

✅ စစ်ဖို့ → type(), isinstance()

python
# ===== 1. Basic Data Types Examples =====
# Integer
age = 25
print(f"Age: {age}, Type: {type(age)}")

# Float
pi = 3.14
print(f"Pi: {pi}, Type: {type(pi)}")

# String
name = "Sai"
print(f"Name: {name}, Type: {type(name)}")

# Boolean
is_active = True
print(f"Active: {is_active}, Type: {type(is_active)}")

print("\n===== 2. Collection Types =====")

# List
fruits = ["apple", "banana", "cherry"]
print(f"List: {fruits}, Type: {type(fruits)}")

# Tuple
colors = ("red", "green", "blue")
print(f"Tuple: {colors}, Type: {type(colors)}")

# Set
nums = {1, 2, 3, 3}
print(f"Set: {nums}, Type: {type(nums)}")

# Dictionary
person = {"name": "Sai", "age": 25}
print(f"Dict: {person}, Type: {type(person)}")

print("\n===== 3. Type Checking with isinstance() =====")
x = 10
print(f"x = {x}")
print(f"isinstance(x, int): {isinstance(x, int)}")
print(f"isinstance(x, float): {isinstance(x, float)}")
You should see
Age: 25, Type: Pi: 3.14, Type: Name: Sai, Type: Active: True, Type: ===== 2. Collection Types ===== List: ['apple', 'banana', 'cherry'], Type: Tuple: ('red', 'green', 'blue'), Type: Set: {1, 2, 3}, Type: Dict: {'name': 'Sai', 'age': 25}, Type: ===== 3. Type Checking with isinstance() ===== x = 10 isinstance(x, int): True isinstance(x, float): False
Python Data Types | Thuta Learning