ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

5_元组

2022-08-05 00:01:31  阅读:26  来源: 互联网

标签:99999 上山 老虎 爱我吗 123 print 元组


a = (1, 2, 3, 4, 5, "上山打老虎")
# (1, 2, 3, 4, 5, '上山打老虎')
print(a)
# 4
print(a[3])
# (1, 2, 3, 4, 5, '上山打老虎')
print(a[:])
# (1, 3, 5)
print(a[::2])
# ('上山打老虎', 5, 4, 3, 2, 1)
print(a[::-1])

s = (1, 2, 3)
t = (4, 5, 6)
w = (s, t)
# (1, 2, 3, 4, 5, 6)
print(s+t)
# ((1, 2, 3), (4, 5, 6))
print(w)
b = (123, "我爱你", "你爱我吗", 99999)
x, y, z, m = b
# 123  我爱你   你爱我吗    99999
print(x, "\n",  y, "\n", z, "\n", m)
x, y = 10, 20
print(x)
print(y)

 

标签:99999,上山,老虎,爱我吗,123,print,元组
来源: https://www.cnblogs.com/tuyin/p/16552711.html

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有