การใช้งาน Built in tuple ในภาษา python

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: การใช้งาน Built in tuple ในภาษา python

Re: การใช้งาน Built in tuple ในภาษา python

โดย Jom07 » 26/01/2018 5:19 pm

min(tuple) element ที่มีค่ามากที่สุด

โค้ด: เลือกทั้งหมด

x = ('name12', 'name123', 'name1234')
y = (1000, 2000, 3000)

print(min(x))
print(min(y))
ผลรัน
รูปภาพ

tuple(sqe)แปลง sequence (List ) ให้เป็น Tuple

โค้ด: เลือกทั้งหมด

x = {'name12', 'name123', 'name1234'}
y =tuple(x)
print(y)
ผลรัน
รูปภาพ

ศึกษาข้อมูลจาก :https://www.youtube.com/watch?v=9DP8i7x ... M&index=54

การใช้งาน Built in tuple ในภาษา python

โดย Four » 26/01/2018 5:14 pm

len(tuple) จำนวน element ทั้งหมดใน tuple

โค้ด: เลือกทั้งหมด

test = ("python", "mindphp", "1234")
test2 = ("python", "mindphp")
print(len(test))
print(len(test2))
max(tuple) element ที่มีค่ามากที่สุด

โค้ด: เลือกทั้งหมด

test3 = ("python", "mindphp", "tuple")
test4 = (123, 456, 789)
print(max(test3))
print(max(test4))
ผลรัน

รูปภาพ

ศึกษาข้อมูลจาก : https://www.youtube.com/watch?v=9DP8i7x ... M&index=54

ข้างบน