Python的练习题不会做

作业不会做了,顺便学习下

img


l=[]
for i in range(8):
    a=int(input('请输入201'+str(i+1)+'年的黄金储备:'))
    l.append(a)
print('最高储备值'+str(max(l))+'和平均储备值'+str(sum(l)/8.0))

import numpy as np
l = []
for i in range(1, 9):
    a = int(input("请输入201" + str(i) + "年的黄金储备:"))
    l.append(a)
print("最高储备值" + str(max(l)) + "和平均储备值" + str(np.mean(l)))

img

b=[]
for i in range(8):
    a=int(input('请输入201'+str(i+1)+'年的黄金储备:'))
    b.append(a)
print('最高储备值'+str(max(b))+'和平均储备值'+str(sum(b)/8.0))
 

希望采纳

max_ = 0
sum_ = 0
for i in range(8):
    ipt = int(input("请输入201" + str(i + 1) + "年的黄金储备:"))
    if ipt > max_:
        max_ = ipt
    sum_ += ipt
print("最高储备值" + str(max_) + "和平均储备值" + str(sum_ / 8.0))