元组特点
1. 可以容纳多个数据
 2. 可以容纳不同类型的数据 (混装)
 3. 数据是有序存储的 (下标索引)
 4. 允许重复数据存在
 5. 不可以修改 (增加或删除元素等)  【可以修改内部list的内部元素---见页尾】
 6. 支持for和while循环
定义元组
# 定义元组
变量 = (元素, 元素2, 元素3...)# 定义空元组
变量 = ()
变量 = tuple()# 定义单个元素   --------  需要在元素后面加个逗号
变量 = (元素, )例子:
t1 = (1, "hello", True)
t2 = ()
t3 = tuple()
print(type(t1), type(t2), type(t3))  # <class 'tuple'> <class 'tuple'> <class 'tuple'>t4 = ("hello",)
t5 = ("hello")
print(type(t4))  # <class 'tuple'>
print(type(t5))  # <class 'str'>元组嵌套
# 元组嵌套
变量 = ((元素, 元素2, 元素3...), (元素, 元素2, 元素3...)...)例子:
t6 = ((1, 2, 3), (4, 5, 6))
print(type(t6))  # (1, 2, 3)元组方法
# 1. 下标索引取出内容
t6 = ((1, 2, 3), (4, 5, 6))
num = t6[1][2]
print(num)  # 6# 2. 查找 index方法
t7 = (11, 3, 2, 1, 5, 4, 3, 6, 9, 3)
print(t7.index(3))  # 1# 3. 统计 count方法
print(t7.count(3))  # 3# 4. 长度 len方法
print(len(t7))  # 10元组遍历
# 元组遍历 while
t = (1, 2, 3, 4, 5, 4, 6, 3, 8, 4, 95, 0, 10)
index = 0
while index < len(t):print(t[index])index += 1# 元组遍历 for
for i in t:print(i)注意:元组不可以修改内容 (增加或删除元素等) 【但是可以修改内部list的内部元素】
t8 = (1, 2, 3, [4, 5, 6])
# t8[0] = "hi"# 不能修改元组内容
# print(t8[0])
t8[3][1] = "hello"
t8[3][2] = "hey"
print(t8[3][1])   # hello   可以修改内部list的内部元素
print(t8[3][2])   # hey     可以修改内部list的内部元素