🏠 Home / Hub

🐍 Python Lesson 01 — Setup, Syntax & Print

← Back to Python Menu

1. Python ဆိုတာဘာလဲ

Python က readable ဖြစ်တဲ့ programming language တစ်ခုပါ။ Web backend, automation, data, AI, scripting, security tools စတဲ့နေရာတွေမှာသုံးတယ်။ Beginner အတွက် syntax ရိုးပြီး output ကိုမြန်မြန်မြင်ရတာကြောင့် စသင်ဖို့ကောင်းတယ်။

2. Setup

1. python.org ကနေ Python install လုပ်ပါ
2. Install screen မှာ "Add Python to PATH" ကို check လုပ်ပါ
3. VS Code install လုပ်ပြီး Python extension ထည့်ပါ
4. Terminal မှာ version စစ်ပါ

python --version
pip --version
Windows မှာ python မရရင် py --version နဲ့စမ်းပါ။

3. print() နဲ့ Output ထုတ်ခြင်း

print("Hello Python")
print("Mg Mg")
print(100)
print("Total:", 5000)

# f-string
name = "Aung Aung"
age = 20
print(f"My name is {name}. I am {age} years old.")

4. input() နဲ့ User Data ယူခြင်း

name = input("Enter your name: ")
print(f"Welcome, {name}")

age = input("Enter age: ")
print(type(age))  # input က string အနေနဲ့ဝင်လာတယ်

5. Indentation

Python မှာ block ခွဲဖို့ curly braces မသုံးဘဲ spaces သုံးတယ်။ Usually 4 spaces သုံးပါ။

if True:
    print("This is inside if")
    print("Same block")

print("Outside block")
Indentation မှားရင် code မ run ပါ။ Python မှာ spacing က syntax အစိတ်အပိုင်းတစ်ခုပါ။

6. Comments

# One line comment

"""
Multi-line note အနေနဲ့ သုံးလို့ရတယ်။
Documentation string လို့လည်းခေါ်တယ်။
"""

📌 Study Checklist