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

วิธีใช้ Python ในโหมดโต้ตอบ (Interactive Mode)

รัน python จาก command prompt เพื่อเข้าสู่ Python interactive shell

C:\user> python
>>>

Prompt ของ Python ประกอบด้วยเครื่องหมาย >>> สามารถประเมิน expression ใดๆ ได้ทันที

>>> 2+3*5
17

สามารถกำหนดค่าตัวแปร รับ input และพิมพ์ค่าได้:

>>> name = input("enter your name: ")
enter your name TutorialsPoint
>>> name
'TutorialsPoint'