Variable ဆိုတာ data သိမ်းတဲ့ နာမည်ပေးထားတဲ့ box လိုပါပဲ။ Python မှာ type ကိုကြိုရေးစရာမလိုဘူး။
name = "Su Su" age = 21 height = 5.4 is_student = True address = None
| Type | Example | Use |
|---|---|---|
| str | "Hello" | Text |
| int | 100 | Whole number |
| float | 19.99 | Decimal number |
| bool | True / False | Decision |
| NoneType | None | No value |
print(type("Hello")) # <class 'str'>
print(type(100)) # <class 'int'>
print(type(3.14)) # <class 'float'>
print(type(True)) # <class 'bool'>
print(type(None)) # <class 'NoneType'>age_text = "20" age = int(age_text) price_text = "12.50" price = float(price_text) count = 5 message = "Total is " + str(count)
input() က string ပြန်ပေးတာမို့ number တွက်မယ်ဆို int() / float() ပြောင်းရမယ်။
name = "Mg Mg"
score = 85
print("Name:", name, "Score:", score)
print("Name is " + name)
print(f"{name} got {score} marks") # recommended# Good student_name = "Aye Aye" total_price = 25000 is_active = True # Bad # 2name = "wrong" # total-price = 100 # class = "reserved keyword"