新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Python程序:創(chuàng)建不同類型元組
創(chuàng)新互聯(lián)python教程:

網(wǎng)站設計制作過程拒絕使用模板建站;使用PHP+MYSQL原生開發(fā)可交付網(wǎng)站源代碼;符合網(wǎng)站優(yōu)化排名的后臺管理系統(tǒng);網(wǎng)站設計、網(wǎng)站建設收費合理;免費進行網(wǎng)站備案等企業(yè)網(wǎng)站建設一條龍服務.我們是一家持續(xù)穩(wěn)定運營了十載的成都創(chuàng)新互聯(lián)網(wǎng)站建設公司。
寫一個 Python 程序來創(chuàng)建不同類型的元組并打印出來。這個 Python 示例顯示了整數(shù)、字符串、布爾、浮點、混合元組、元組內(nèi)部的元組(嵌套元組)和列表元組的創(chuàng)建。
# Different Type Tuples
numericTuple = (10, 20, 30, 40, 50)
print("Numeric Tuple Items = ", numericTuple )
floatTuple = (10.25, 11.20, 19.37, 41.598)
print("Float Tuple Items = ", floatTuple )
stringTuple = ('orange', 'Mango', 'Grape', 'Apple')
print("String Tuple Items = ", stringTuple )
booleanTuple = (True, False, False, True, True)
print("Boolean Tuple Items = ", booleanTuple )
mixedTuple = ('orange', 25, 'Mango', 36.75, False, 10)
print("Mixed Tuple Items = ", mixedTuple )
nestedTuple = (10, 20, ('orange', 'Mango'), 30)
print("Nested Tuple Items = ", nestedTuple )
listTuple = (10, 20, ['Grape', 'Apple'], 70)
print("List Tuple Items = ", listTuple ) 文章名稱:Python程序:創(chuàng)建不同類型元組
URL地址:http://fisionsoft.com.cn/article/dhepged.html


咨詢
建站咨詢
