แชร์ความรู้ภาษา Python ไพทอน การเขียนโปรแกรมภาษาไพทอน
Moderator: mindphp , ผู้ดูแลกระดาน
anuwat somsakul
PHP Full Member
โพสต์: 44 ลงทะเบียนเมื่อ: 08/08/2018 9:49 am
โพสต์ที่ยังไม่ได้อ่าน
โดย anuwat somsakul » 10/08/2018 3:30 pm
การสร้างฟังก์ชั่น ในไพทอน Python Defining function โดยมี Keyword Arguments
โค้ด: เลือกทั้งหมด
def mykey(i,phone="Phone number is not specified",email="Email is not specified"):
print("-- ID",i)
print("-- phone",phone)
print("-- keyword arg email:",email,"!")
mykey('001','0485255455')
mykey(email='[email protected] ',i=415525)
ผลลัพธ์
Selection_009.png (11.35 KiB) Viewed 770 times
jirawoot
PHP VIP Members
โพสต์: 3129 ลงทะเบียนเมื่อ: 17/06/2019 10:30 am
โพสต์ที่ยังไม่ได้อ่าน
โดย jirawoot » 20/06/2019 3:19 pm
โค้ด: เลือกทั้งหมด
def mykey(i,phone='phone number is not', email='email is not'):
print('ID = ',i)
print('phone =',phone)
print('email=', email)
mykey('001','0844235555')
ผลลัพธ์
Selection_018.png (7.22 KiB) Viewed 408 times
0 ตอบกลับ
717 แสดง
โพสต์ล่าสุด โดย athirach.offcial
29/03/2024 3:20 pm
0 ตอบกลับ
4418 แสดง
โพสต์ล่าสุด โดย Jom07
06/03/2018 3:17 pm
2 ตอบกลับ
804 แสดง
โพสต์ล่าสุด โดย Udomsak2539
15/09/2020 10:07 am
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 73