21-06-2020, Saat: 21:26
9- Python Tuple Kullanım Örneği
Kod:
# Boş tuple
tuple1 = ()
print(tuple1) # çıktı: ()
# tamsayı türünde değerleri olan tuple
tuple2 = (1, 2, 3)
print(tuple2) # çıktı: (1, 2, 3)
# karışık veri tipleri örneği
tuple3 = (1, "Selam", 3.4)
print(tuple3) # çıktı: (1, "Selam", 3.4)
# iç içe tuple örneği
tuple4 = ("fare", [8, 4, 6], (1, 2, 3))
# Output: ("fare", [8, 4, 6], (1, 2, 3))
print(tuple4)