โดย rangsan » 03/05/2018 11:58 am
การสร้างฟังก์ชันโดยมี Keyword
โค้ด: เลือกทั้งหมด
def keyWordFunction(ID,Name="Name not found",Lastname="Lastname not found",Gender="Gender is not defind",Phone="Phone is not defind",Email="Email is not defind",Address="Address is not defind"):
print "Go to Function"
print ("---ID : ",ID)
print ("---Name : ",Name)
print ("---Lastname: ",Lastname)
print ("---Gender : ",Gender)
print ("---Phone : ",Phone)
print ("---Email : ",Email,"!!")
print ("---Address : ",Address)
keyWordFunction(58,'Rangsan','Mungklang','Male',Phone='08-78888898',Address="88/99 Hongprayoun Village Nonthaburi Bangbuathong 11110")
print "---Finish Function---”
ผลการรันโค้ด
- keyWord_function.png (42.88 KiB) Viewed 1121 times
ศึกษาจาก :
https://www.youtube.com/watch?v=4cI5sSk ... lzdKrpxsMM
[b][color=#BF4000]การสร้างฟังก์ชันโดยมี Keyword[/color][/b]
[code]def keyWordFunction(ID,Name="Name not found",Lastname="Lastname not found",Gender="Gender is not defind",Phone="Phone is not defind",Email="Email is not defind",Address="Address is not defind"):
print "Go to Function"
print ("---ID : ",ID)
print ("---Name : ",Name)
print ("---Lastname: ",Lastname)
print ("---Gender : ",Gender)
print ("---Phone : ",Phone)
print ("---Email : ",Email,"!!")
print ("---Address : ",Address)
keyWordFunction(58,'Rangsan','Mungklang','Male',Phone='08-78888898',Address="88/99 Hongprayoun Village Nonthaburi Bangbuathong 11110")
print "---Finish Function---”
[/code]
ผลการรันโค้ด
[attachment=0]keyWord_function.png[/attachment]
ศึกษาจาก : https://www.youtube.com/watch?v=4cI5sSkOJ_8&index=16&list=PLLi1ciqQAf8TVFbJpl7XY23lzdKrpxsMM