example ใช้ github codespace

1. Functions

Functions
สร้าง function โดยเริ่มที่ def , name และ () และ :
statement ใช้ indention
variable ใน statment , ใช้ return เพื่อให้ได้ output
print(f’ string , concatenate function โดยใช้ {} )
ไม่จำเป็นที่ทุก function ต้องมี return , ขึ้นกับ purpose
กรณีที่ไม่มี return value – function จะ execure และ return automatically , passing back None เป็น output , None นี้เป็น object และเป็น speical data ที่ python ใช้บอกว่ามันไม่มี value

Code reuse
ใช้ในส่วนที่ similar tasks
และถ้าต้องการเปลี่ยนแปลง common task ,ก็สามารถแก้ที่ที่เดียว

Parameters and arguments



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

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

Continue reading