🎉 ยินดีด้วย! Congratulations!
คุณพร้อมที่จะใช้ AI แก้ปัญหาจริงแล้ว!
You're ready to use AI for real problem-solving!
ในหน้านี้ คุณจะได้เรียนรู้การใช้ AI สร้างโค้ด แก้ปัญหาในชีวิตจริง และสร้างโปรแกรมที่มีประโยชน์
You'll learn to use AI for code generation, solve real problems, and create useful programs!
💻 บทเรียนที่ 1
Tutorial 1
AI Code Generation - Basics
การใช้ AI สร้างโค้ดเบื้องต้น
🌱 Easy
สิ่งที่คุณจะได้เรียนรู้:
- วิธีขอให้ AI เขียนโค้ดอย่างมีประสิทธิภาพ
- การอธิบายปัญหาให้ AI เข้าใจ
- การทดสอบและปรับปรุงโค้ดที่ได้
- ตัวอย่างการสร้างโปรแกรมง่ายๆ
What You'll Learn:
Master the art of asking AI to write code! You'll learn how to describe problems clearly, test generated code, and create simple but useful programs.
1การเขียน Prompt ที่ดี - Writing Good Prompts
Prompt คือคำสั่งหรือคำถามที่คุณให้ AI สิ่งสำคัญคือต้องชัดเจน เฉพาะเจาะจง และระบุรายละเอียดที่จำเป็น
Prompt ที่ดี ควรมี:
- อธิบายปัญหาหรือสิ่งที่ต้องการ
- ระบุภาษาโปรแกรมที่ต้องการ
- บอกข้อกำหนดพิเศษ (ถ้ามี)
- ขอให้อธิบายโค้ดด้วย
English: A prompt is the instruction or question you give to AI. The key is to be clear, specific, and include necessary details.
Good prompts should have:
- Clear description of the problem or desired outcome
- Specific programming language
- Any special requirements
- Request for code explanation
2ตัวอย่างที่ 1: คำนวณดอกเบี้ยทบต้น
ปัญหา: คุณต้องการโปรแกรมคำนวณว่าถ้าฝากเงิน 10,000 บาท ดอกเบี้ย 5% ต่อปี ทบต้นทุกเดือน จะได้เงินเท่าไหร่ใน 5 ปี?
English: Problem - You need a program to calculate: If you deposit 10,000 baht at 5% annual interest, compounded monthly, how much will you have after 5 years?
Prompt ที่ให้ AI:
"เขียนโปรแกรม Python คำนวณดอกเบี้ยทบต้น ใช้สูตร A = P(1 + r/n)^(nt) โดยที่ P=เงินต้น, r=อัตราดอกเบี้ย, n=จำนวนครั้งที่ทบต้นต่อปี, t=จำนวนปี พร้อมอธิบายแต่ละบรรทัด"
English: Prompt for AI - "Write a Python program to calculate compound interest using the formula A = P(1 + r/n)^(nt) where P is principal, r is rate, n is compounds per year, t is time in years. Include explanations."
English: After getting code from AI, you can ask: "Explain this code line by line", "Add error handling", or "Create a GUI for this code"
🔧 บทเรียนที่ 2
Tutorial 2
Practical Python with AI
Python ใช้งานจริงด้วย AI
🔍 Medium
โปรเจกต์จริงที่ AI ช่วยสร้างได้:
- จัดการไฟล์อัตโนมัติ
- ดึงข้อมูลจากเว็บไซต์
- วิเคราะห์ข้อมูล Excel/CSV
- สร้างกราฟและรายงาน
- ส่งอีเมลอัตโนมัติ
Real Projects AI Can Help Build:
AI can help you create practical programs: automated file organization, web scraping, Excel data analysis, graph generation, automated email sending, and much more!
1ตัวอย่างที่ 2: จัดระเบียบไฟล์อัตโนมัติ
ปัญหา: โฟลเดอร์ Downloads ของคุณยุ่งเหยิง มีไฟล์หลายร้อยไฟล์ปนกัน ต้องการโปรแกรมที่จัดเรียงไฟล์ตามประเภท (รูปภาพ, เอกสาร, วิดีโอ, ฯลฯ)
English: Problem - Your Downloads folder is messy with hundreds of files mixed together. You need a program to organize files by type (images, documents, videos, etc.)
Prompt: "เขียนโปรแกรม Python จัดระเบียบไฟล์ในโฟลเดอร์โดยอัตโนมัติ แยกไฟล์ตามนามสกุล (jpg, png → Images, pdf, docx → Documents, mp4, avi → Videos) สร้างโฟลเดอร์ใหม่ถ้ายังไม่มี และย้ายไฟล์ไปยังโฟลเดอร์ที่เหมาะสม"
2ตัวอย่างที่ 3: วิเคราะห์ข้อมูลยอดขาย
ปัญหา: คุณมีไฟล์ Excel บันทึกยอดขายรายวัน ต้องการโปรแกรมที่อ่านไฟล์ คำนวณยอดขายรวม ยอดขายเฉลี่ย และสร้างกราฟแสดงยอดขายแต่ละเดือน
English: Problem - You have an Excel file with daily sales records. You need a program to read the file, calculate total sales, average sales, and create a graph showing monthly sales.
English: If you don't have sample data, ask AI to create it! Type "Create a sample Excel file with 30 days of sales data, with Date and Sales columns"
3ตัวอย่างที่ 4: ตรวจสอบราคาหุ้นอัตโนมัติ
ปัญหา: ต้องการโปรแกรมที่ดึงราคาหุ้นตัวโปรดจากอินเทอร์เน็ต แสดงราคาปัจจุบัน และส่ง alert ถ้าราคาสูงหรือต่ำกว่าที่กำหนด
English: Problem - You need a program that fetches your favorite stock prices from the internet, displays current prices, and sends alerts if prices go above or below set thresholds.
pip install yfinance และข้อมูลมีความล่าช้า 15-20 นาที สำหรับการลงทุนจริง ควรใช้ API แบบเสียเงินที่มีข้อมูล real-time
English: Note: Install yfinance first: pip install yfinance. Data has 15-20 minute delay. For real investing, use paid APIs with real-time data.
⭐ Best Practices - เทคนิคการใช้ AI อย่างมืออาชีพ
💡 Professional Tips for Using AI
- Always test AI-generated code: อย่าเชื่อโค้ดที่ได้ทันที ทดสอบก่อนใช้งานจริง
- Ask for explanations: ขอให้ AI อธิบายโค้ดเพื่อให้คุณเข้าใจและเรียนรู้
- Iterate and improve: ถ้าผลลัพธ์ไม่ใช่ที่ต้องการ บอก AI และขอให้ปรับปรุง
- Add error handling: ขอให้ AI เพิ่ม error handling เพื่อจัดการข้อผิดพลาด
- Request comments: ขอให้ใส่ comment อธิบายโค้ดเสมอ
- Verify calculations: ตรวจสอบผลลัพธ์ทางคณิตศาสตร์ด้วยตัวเอง
- Check for security: ตรวจสอบว่าโค้ดมีช่องโหว่ด้านความปลอดภัยหรือไม่
- Learn from the code: อ่านและทำความเข้าใจ อย่าแค่ copy-paste
⚠️ Things to Watch Out For
- AI can make mistakes: AI ไม่ได้ถูกเสมอ ตรวจสอบผลลัพธ์ทุกครั้ง
- Outdated libraries: AI อาจแนะนำ library เวอร์ชันเก่า ตรวจสอบ documentation
- Security concerns: ระวังโค้ดที่อาจมีช่องโหว่ เช่น SQL injection
- License issues: โค้ดบางส่วนอาจมีลิขสิทธิ์ ตรวจสอบก่อนใช้เชิงพาณิชย์
- Don't share sensitive data: อย่าส่งข้อมูลส่วนตัวหรือรหัสผ่านให้ AI
- API limits: ระวังค่าใช้จ่าย API ถ้าใช้บ่อยเกินไป
🏆 คุณเก่งมาก! You're Doing Great!
คุณได้เรียนรู้การใช้ AI สร้างโค้ดและแก้ปัญหาจริงแล้ว!
You've learned to use AI for code generation and real problem-solving!
ตอนนี้คุณพร้อมที่จะทดสอบความรู้
Now you're ready to test your knowledge!
ไปทำ AI Exam เพื่อดูว่าคุณเรียนรู้มาแค่ไหน!