Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

Python Interpreters: คู่มือออนไลน์สำหรับผู้เริ่มต้น

Python เรียนรู้ง่ายมาก เพราะ Python Interpreters มีออนไลน์ ไม่ต้องกังวลเรื่อง version ที่ติดตั้งบนเครื่อง บทความนี้พูดถึงว่า Python Interpreter คืออะไร และรายชื่อ interpreters ยอดนิยม เหมาะสำหรับผู้เริ่มต้น ใช้งานออนไลน์ได้



Python Program ทำงานอย่างไร?

Python Interpreters: คู่มือออนไลน์สำหรับผู้เริ่มต้น

Python คล้าย Java ไม่จัดเป็น interpreted language หรือ compiled language อย่างสมบูรณ์ เป็นทั้งสองอย่างเล็กน้อย

Compiled ในที่นี้หมายถึงแปลเป็น lower level language ไม่ขึ้นกับ platform ใดๆ แต่ไม่เหมือน Java หรือ C เราไม่รัน compilation command สำหรับ Python โดยเฉพาะ เรา invoke script ด้วยคำสั่งแบบ python3 hello_world.py โดย "hello_world.py" คือชื่อไฟล์ และมัน execute แล้วมันไปจากนั้น?

ใน Python compilation เกิดขึ้นเมื่อจำเป็น — และเฉพาะเมื่อจำเป็น เทียบได้กับ Java Python กลายเป็น intermediary code เรียกว่า bytecode นี่คือโค้ดที่ interpreter ใน Python Virtual Machine อ่าน แปลโค้ดให้เครื่องอ่านได้

Python Interpreters แนะนำสำหรับผู้เริ่มต้น

รายการต่อไปคือ online environments/sandboxes ที่สร้าง project ด้วย Python ได้ ไม่ใช่ exhaustive list แต่ช่วยเริ่มต้นได้

Repl.it

Python Interpreters: คู่มือออนไลน์สำหรับผู้เริ่มต้น

Repl.it เป็น user-friendly Integrated Development Environment (IDE) ช่วยสร้าง projects ใน Python และภาษาอื่นๆ มากมาย แค่สร้างไฟล์และกด run จะ interpreted ให้ ตอนสร้าง Python repl ใหม่ กด "examples to get started" เล่น sample programs ได้

Python Tutor

Python Interpreters: คู่มือออนไลน์สำหรับผู้เริ่มต้น

Python Tutor เป็น free tool ช่วย visualize code snippets แบบ step-by-step เครื่องมือดีช่วยเรียนรู้ fundamentals ของ Python และ debug แต่ไม่เหมาะกับ full-blown project Interpreter นี้ทำงานสำหรับ Python code และอีกภาษาบางภาษา ช่วย visualize walkthrough ของโค้ด

Ideone

Python Interpreters: คู่มือออนไลน์สำหรับผู้เริ่มต้น

น่าสนใจของ Ideone.com คือรู้สึกเหมือน coding environment เช่น Hackerrank, Leetcode, หรือ Visual Studio Code IDE ดีสำหรับ test code snippets เล็กๆ ดูว่าทำงานได้ ไม่มีความสามารถ multi-file หรือ multi-folder project ขณะนี้ ในบทความนี้ เราดูว่า Python ถูก interpret ยังไง และ online resources เขียน Python รันได้ คุณพร้อมเริ่ม journey สู่ Python Developer หรือ Data Scientist แล้ว!