Thuta Learning
BasicProgrammingbeginner

Python Data Types

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

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

🐍 Lesson 6: Python Data Types

1. What is a data type?

Short answer → A data type refers to the kind of value stored in a variable.

In other words → A data type defines the kind of value a variable holds.

2. Python's Main 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 Typeအမည် (မြန်မာ)Properties
listစာရင်းordered, changeable
tupleမပြောင်းလဲနိုင်တဲ့ စာရင်းordered, unchangeable
setထပ်မရှိတဲ့ အစုunordered, no duplicates
dict (Dictionary)Key-Value စုံkey-value pairs, changeable

4. Checking a Data Type

  • type() → shows a variable's data type
  • isinstance() → checks whether a variable matches a given data type

5. Summary

✅ Data Type = the kind of value stored in a variable

✅ Basic → int, float, str, bool

✅ Collection → list, tuple, set, dict

✅ To check → 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