# 求和
l = [88,97,79,89,76]
re = 0
for i in l:
re += 1
print(re//5) # 平均值
#
print(sum(l)) # he
print(max(l)) # max
# max 推演思路
#默认第一个值最大 打擂 l[0]
# 后边的元素和参照物依次作比较循环
# 后边元素大于参照物 重新赋值给参照物
l = [88,97,79,89,76]
max_num = l[0] # 参照物
i = 1 # 不用和本身比较 和 后一位比较
while i < len(l):
if l[i]> max_num:
max_num = l[i]
i += 1
print(max_num)
l = [88,97,79,89,76]
xiao_num = l[0]
i = 1
while i < len(l):
if l[i] < xiao_num:
xiao_num = l[i]
i += 1
print(xiao_num)
# reverse 源列表反转
# sort 正序排序
l = [88,97,79,89,76]
l.reverse()
print(l) # [76, 89, 79, 97, 88]
# 反序推演过程
l = [88,97,79,89,76]
i = len(l)- 1
while i >=0:
print(l[i],end=' ') # + end=' ' 结束默认换行
i -= 1
# 76, 89, 79, 97, 88
# 正序推演过程
i = 0
while i < len(l):
print(l[i])
i += 1
# 88,97,79,89,76
# 求和
l = [88,97,79,89,76]
re = 0
for i in l:
re += 1
print(re//5) # 平均值
#
print(sum(l)) # he
print(max(l)) # max
# max 推演思路
#默认第一个值最大 打擂 l[0]
# 后边的元素和参照物依次作比较循环
# 后边元素大于参照物 重新赋值给参照物
l = [88,97,79,89,76]
max_num = l[0] # 参照物
i = 1 # 不用和本身比较 和 后一位比较
while i < len(l):
if l[i]> max_num:
max_num = l[i]
i += 1
print(max_num)
l = [88,97,79,89,76]
xiao_num = l[0]
i = 1
while i < len(l):
if l[i] < xiao_num:
xiao_num = l[i]
i += 1
print(xiao_num)
#
# reverse 源列表反转
# sort 正序排序
l = [88,97,79,89,76]
l.reverse()
print(l) # [76, 89, 79, 97, 88]
# 反序
l = [88,97,79,89,76]
i = len(l)- 1
while i >=0:
print(l[i],end=' ') # + end=' ' 结束默认换行
i -= 1
# 76, 89, 79, 97, 88
# # 正序
i = 0
while i < len(l):
print(l[i])
i += 1
# 88,97,79,89,76