Programming การเขียนโปรแกรม
A beginner path that pairs how computers handle data with hands-on Python practice เส้นทางสำหรับผู้เริ่มต้น เรียนวิธีที่คอมพิวเตอร์จัดการข้อมูลควบคู่กับการฝึกเขียน Python
Overview ภาพรวม
Programming turns an idea into exact steps that a computer can follow. The lessons here are short and practical: each one explains one idea, shows it in a small example, and lets you check yourself before you move on. The Python examples run on the page itself, so you can see what each line does without installing anything first.
การเขียนโปรแกรมคือการเปลี่ยนความคิดให้เป็นขั้นตอนที่ชัดเจนจนคอมพิวเตอร์ทำตามได้ บทเรียนในหมวดนี้สั้นและเน้นลงมือทำ แต่ละบทอธิบายแนวคิดเดียว แสดงด้วยตัวอย่างเล็ก ๆ แล้วให้ตรวจความเข้าใจก่อนไปบทถัดไป ตัวอย่าง Python รันบนหน้าเว็บได้เลย จึงเห็นว่าแต่ละบรรทัดทำอะไรโดยไม่ต้องติดตั้งโปรแกรมก่อน
Why this order ทำไมต้องเรียนตามลำดับนี้
Start with 01 Basic, then move on to 02 Python. Python is much easier to read once you know what the computer does underneath. Three examples from the lessons:
เริ่มจาก 01 Basic แล้วจึงต่อด้วย 02 Python เพราะเมื่อรู้ว่าคอมพิวเตอร์ทำอะไรอยู่เบื้องหลัง โค้ด Python จะอ่านเข้าใจง่ายขึ้นมาก ตัวอย่างจากบทเรียนสามเรื่อง
- Numbers. 01 Basic shows how a whole number is stored as bits and how negative numbers are
written in two's complement. When 02 Python introduces
intandfloat, the difference between a whole number and a decimal is something you have already seen, not a rule to memorise. - Text. The ASCII lesson shows that every character is stored as a number, and that a capital
letter and its small letter are exactly 32 apart. In 02 Python the same idea comes back with
ord()andchr(), so changing'A'into'a'becomes simple arithmetic. - Logic. A flowchart splits a problem into steps, decisions and repeats before any code exists.
A decision box later becomes an
if/elsestatement, and an arrow that goes back to an earlier step becomes afororwhileloop.
- ตัวเลข 01 Basic แสดงว่าจำนวนเต็มถูกเก็บเป็นบิตอย่างไร และจำนวนลบเขียนแบบ two's complement อย่างไร
เมื่อถึง
intและfloatใน 02 Python ความต่างระหว่างจำนวนเต็มกับทศนิยมจึงเป็นสิ่งที่เคยเห็นมาแล้ว ไม่ใช่กฎที่ต้องท่องจำ - ข้อความ บท ASCII แสดงว่าตัวอักษรทุกตัวถูกเก็บเป็นตัวเลข และตัวพิมพ์ใหญ่กับตัวพิมพ์เล็กของตัวเดียวกันห่างกัน 32 พอดี
ใน 02 Python แนวคิดเดียวกันกลับมาในรูป
ord()และchr()การเปลี่ยน'A'เป็น'a'จึงเป็นแค่การบวกเลข - ตรรกะ flowchart แบ่งปัญหาออกเป็นขั้นตอน การตัดสินใจ และการทำซ้ำ ก่อนจะมีโค้ดสักบรรทัด
กล่องตัดสินใจจะกลายเป็นคำสั่ง
if/elseและลูกศรที่ย้อนกลับไปขั้นก่อนหน้าจะกลายเป็น loop แบบforหรือwhile
What you will be able to do สิ่งที่คุณจะได้
After both sections you will be able to:
เมื่อเรียนจบทั้งสองหมวด คุณจะสามารถ
- write a program that reads input from the user, calculates a result and prints it in a clear format;
- keep groups of data in lists and dictionaries and process them, for example counting votes or finding the largest jump in a series of sensor readings;
- read data from a text file and write results back to a file;
- choose a suitable structure —
if/else,match-case, afororwhileloop,try/except— for a given task; - find a bug by tracing the code line by line, fix it, and test the program again.
- เขียนโปรแกรมที่รับ input จากผู้ใช้ คำนวณ แล้วแสดงผลลัพธ์ให้อ่านง่าย
- เก็บข้อมูลเป็นกลุ่มด้วยลิสต์และ dictionary แล้วประมวลผล เช่น นับคะแนนโหวต หรือหาค่าที่กระโดดมากที่สุดในชุดค่าที่อ่านจาก sensor
- อ่านข้อมูลจากไฟล์ข้อความ และเขียนผลลัพธ์กลับลงไฟล์
- เลือกโครงสร้างที่เหมาะกับงาน ได้แก่
if/else,match-case, loop แบบforหรือwhileและtry/except - หา bug โดยไล่โค้ดทีละบรรทัด แก้ไข แล้วทดสอบโปรแกรมอีกครั้ง
Learning tools on this site เครื่องมือช่วยเรียนในเว็บนี้
Each lesson uses the same set of tools:
ทุกบทเรียนใช้เครื่องมือชุดเดียวกัน
- Run button and editable code box — every Python example can be edited and run again. The runner is a JavaScript simulation of Python inside the page; each lesson also links to Google Colab when you want to run real Python.
- Output shown in advance — the expected result is already printed under each example, so you can compare it with your own run.
- Flowcharts — diagrams show the plan of a program before its code.
- Quizzes with explanations — every choice has a short reason, so a wrong answer still teaches something.
- Debugging problems — the pages in the example section each hide one bug in a program that looks correct; your job is to find and fix it.
- ปุ่ม Run และกล่องโค้ดที่แก้ไขได้: แก้ตัวอย่าง Python แล้วรันใหม่ได้ทุกตัวอย่าง ตัวรันเป็นการจำลอง Python ด้วย JavaScript บนหน้าเว็บ และทุกบทมีลิงก์ Google Colab สำหรับรัน Python จริง
- ผลลัพธ์ที่แสดงไว้ล่วงหน้า: ด้านใต้ code มีผลลัพธ์ที่ควรได้แสดงไว้แล้ว จึงเทียบกับผลที่รันเองได้
- flowchart: diagram แสดงแผนของโปรแกรมก่อนเขียนโค้ด
- แบบทดสอบพร้อมคำอธิบาย: ทุกตัวเลือกมีเหตุผลสั้น ๆ ตอบผิดก็ยังได้เรียนรู้
- โจทย์ debugging: แต่ละหน้าในหมวด example ซ่อน bug ไว้หนึ่งจุดในโปรแกรมที่ดูเหมือนถูก หน้าที่ของคุณคือหาและแก้ให้ได้
To get the most out of them, type the code yourself instead of only reading it, change one value at a time and predict the output before you press Run, and take the quiz after you have tried the examples, not before.
เพื่อให้ได้ผลมากที่สุด ให้พิมพ์โค้ดเองแทนการอ่านอย่างเดียว เปลี่ยนค่าทีละค่าและเดาผลลัพธ์ก่อนกด Run และทำแบบทดสอบหลังจากลองตัวอย่างแล้ว
How to use the lessons วิธีใช้บทเรียน
- Open a section from the cards below or the sidebar menu, and take its lessons in their numbered order.
- Finish one lesson before starting the next, and go back to an earlier lesson when a later one builds on its idea.
- Switch between English and Thai at any time with the EN / TH buttons at the top; your choice is kept on the other pages.
- เปิดหมวดจากการ์ดด้านล่างหรือเมนูด้านข้าง แล้วเรียนบทเรียนตามลำดับเลขบท
- เรียนให้จบทีละบทก่อนเริ่มบทใหม่ และย้อนกลับไปบทก่อนหน้าเมื่อบทหลังใช้แนวคิดจากบทนั้น
- สลับภาษาอังกฤษกับไทยได้ทุกเมื่อด้วยปุ่ม EN / TH ด้านบน ภาษาที่เลือกจะใช้ต่อในหน้าอื่นด้วย
Who it is for เหมาะกับใคร
Beginners: students in a first computing or programming course, engineers and scientists who want to automate measurements and calculations, and anyone curious about how software works. No earlier coding experience is needed.
ผู้เริ่มต้น ได้แก่ นักศึกษาที่เรียนวิชาคอมพิวเตอร์หรือการเขียนโปรแกรมเป็นครั้งแรก วิศวกรและนักวิทยาศาสตร์ที่อยากให้การวัด และการคำนวณทำงานอัตโนมัติ และผู้ที่สงสัยว่าซอฟต์แวร์ทำงานอย่างไร ไม่ต้องมีประสบการณ์เขียนโค้ดมาก่อน