>>> L = [75, 92, 59, 68, 99]
>>> sum = 0.0
>>> for x in L:
... sum = sum + x
... print(sum / 5)
File "<stdin>", line 3
print(sum / 5)
^
SyntaxError: invalid syntax
>>>
>>> L = [75, 92, 59, 68, 99]
>>> sum = 0
>>> for l in L:
... sum = sum +l
...
>>> print( sum / 5)
78.6
for和print应该这样对齐。
缩进问题吧,你看下最后的print
这个是求平均值,你这个最后一步好像对齐错了,print跟for对齐