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

Python Syntax

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

Python Syntax & Indentation Visual Guide
Indentation, colon (:), and code block structure ကို မြင်သာအောင်ပြထားတဲ့ visual explanation ဖြစ်ပါတယ်။

🐍 Lesson 3: Python Syntax

1. Syntax ဆိုတာဘာလဲ?

မြန်မာ → Syntax ဆိုတာ Python code ရေးတဲ့ စည်းမျဉ်းစည်းကမ်းတွေကို ဆိုလိုတယ်။

English → Syntax is the set of rules that defines how Python code must be written.

2. Indentation (space/tab သုံးပုံ)

Python မှာ {} မသုံးဘဲ space/tab နဲ့ block ကို ခွဲတယ်။

⚠️ Indentation မှားရင် IndentationError ဖြစ်မယ်။

3. Python Syntax အဓိက Rules

Ruleရှင်းလင်းချက်
Case-sensitiveVariable နာမည်တွေမှာ အကြီး/အသေး ခွဲထားတယ် (name ≠ Name)
IndentationCode block တွေကို space/tab နဲ့ ခွဲတယ်
Line Continuation\ သုံးပြီး ကြောင်းဆက်ရေးနိုင်တယ်
Comments# နဲ့ စတဲ့ စာကြောင်း → Python မဖတ်ဘဲ မှတ်ချက်အနေနဲ့ထားတယ်

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

✅ Python syntax = Indentation အရေးကြီး

✅ Case-sensitive ဖြစ်တယ်

✅ Statement တစ်ကြောင်းချင်းရေးရမယ်

✅ Comment တွေကို # နဲ့ရေးနိုင်

python
# ===== 1. မှန်ကန်သော Indentation =====
if 5 > 2:
    print("Five is greater than two!")  # ✅ Correct

# ===== 2. Case-sensitive Example =====
name = "Sai"
Name = "Aye"
print(name)  # Sai
print(Name)  # Aye

# ===== 3. Line Continuation =====
total = 1 + 2 + 3 + \
        4 + 5 + 6
print(f"Total: {total}")

# ===== 4. Multiple statements in one line =====
x = 5; y = 10; print(f"x + y = {x + y}")
You should see
Five is greater than two! Sai Aye Total: 21 x + y = 15
Python Syntax | Thuta Learning