Windows , Command prompt
> python –version
Mac >python –version
– Mac มี default install python version 2
> python3 –version
– ถ้ายังไม่เคยลง python ใน Mac
> pythonz –version

Install Python ใน Windows , อย่าลืม checkด้านล่าง , Add python.exe to PATH
Install Python ใน Windows , อย่าลืม checkด้านล่าง , Add python.exe to PATH

Windows , หลัง install Python
>python
-เข้าสู่ python shell
– cntr+Z เพื่อ exit
ส่วน Mac เข้า python shell
> python3

ใช้ Editor – VSC
extension – ให้ search python
– View > Command Palette > เลือก Python select interpreter เพื่อเลือก version
– click run button ด้านบนขวา
– หรือที่ prompt , > python hello.py

2.3

3. Conditional and Import

conditionals 4.38/10.41
if it’s sunny and 90* and higher -> stay inside
if it’s raining -> stay in side
otherwise -> go outdoors !
6 python comparators
< less than , <= less than equal to , == equal , >= greater than equal to , > greater than , != not equal
temp = 90 เป็น assign to temp variable
temp == 90 คือ equal
True
temp < 90
False
temperature =95
if temperature > 80 : ทำตาม block
print(“It’s to hot!”)
print(“stay inside!”)
print(“Have a good day!” <- กรณี false , eg temperature = 75
indent ใช้ 2space
ถ้าใช้ 4 space – indentatioError
หรือใส่
if temperature > 80 :
print(“It’s to hot!”)
print(“stay inside!”)
else :
print(“Have a good day!”

4. Lists and Loops

5. Dictionaries , JSON , and Pip


Discover more from อรรถพรคลินิก ศัลยกรรมตกแต่ง Attaporn Plastic Surgery clinic 阿塔蓬博士,曼谷整形外科医生

Subscribe now to keep reading and get access to the full archive.

Continue reading