# any 只要有一个是真的就会返回true
x = [0,0,0]
for each in x:
if each:
print("True")
break
else:
print("False")
# enumerate
x = [1,2,3]
res = []
# print(list(enumerate(x)))
for i in range(len(x)):
res.append((i,x[i]))
print(res)
# enumerate 有个参数start 自定义序列号
x = [1,2,3]
res = []
start = 0
# print(list(enumerate(x)))
for each in x:
res.append((start,each))
start += 1
print(res)
# zip()
x = [1,2,3]
y = [4,5,6]
res = []
# 首先判断两个列表的长度 长的服从短的
if len(x) > len(y):
z = y
else:
z = x
for i in range(len(z)):
res.append((x[i],y[i]))
print(res)
因为要等前面那个人出来后面那个人才进去,所以后面出来的时间减去前面进去的时间就是那个人所花费的时间
# 默认最短的时间(名字)和最长的时间(名字)
max_time = times[0]
min_time = times[0]
max_name = [names[0]]
min_name = [names[0]]
for i in range(1, len(names)):
each_name = names[i]
each_time = times[i] - times[i-1]
if each_time > max_time:
max_name.clear()
max_name.append(each_name)
max_time = each_time
elif each_time == max_time:
max_name.append(each_name)
elif each_time < min_time:
min_name.clear()
min_name.append(each_name)
min_time = each_time
elif each_time == min_time:
min_name.append(each_name)
print(f"速度最快的是:{min_name},耗费时间是:{min_time}")
print(f"速度最慢的是:{max_name},耗费时间是:{max_time}")