问答详情
源自:4-4 Python之for循环

我这个为什么运行失败?

L = [75, 92, 59, 68, 99]

sum =0.0

for x in l:

    sum=sum+x

print(sum/5)


提问者:涙迹 2021-05-13 11:19

个回答

  • 慕移动0364159
    2021-05-13 16:11:27

    第三行的L需要大写,应该是:

    L = [75, 92, 59, 68, 99]

    sum =0.0

    for x in L:

        sum=sum+x

    print(sum/5)