# 元组是不能修改的,增加元素通过使用运算符+和*来改变
# 元组只有一个元素时,需要用逗号隔开
my_tuple = (1,)
my_tuple1 = (2,)
print(my_tuple+my_tuple1)
# (1, 2)
print(my_tuple*4)
# (1, 1, 1, 1)
# 元组单个元素不允许删除,但可以删除整个元组
del my_tuple
# 元组不能修改,但可以通过索引获取部分数据进行拼接,原理和增加元素一样
my_tuple = (1,2,3,4,6,7)
print(my_tuple[:2]+my_tuple[4:])
# (1, 2, 6, 7)
print(my_tuple[:2]+my_tuple[4:]*3)
# (1, 2, 6, 7, 6, 7, 6, 7)
my_tuple = (1,2,3,4,6,7,9,1)
# 获取元组长度
print(len(my_tuple))
# 8
# 获取元组最大值
print(max(my_tuple))
# 9
# 获取元组最小值
print(min(my_tuple))
# 1
# 获取某个元素在元组的数量
print(my_tuple.count(1))
# 2
# 获取某个元素的索引值
print(my_tuple.index(7))
# 5