def main(): fileName = input ("What file are the numbers in? ") infile = open (fileName, 'r' ) sum =0.0 count =0 line = infile.readline ( ) while line != " ": sum=sum+eval(line) count=count+1 line=infile.readline() print ("\nThe average of the numbers is")main()What file are the numbers in? C:\Users\john\Documents\ze.txtTraceback (most recent call last): File "C:/Users/john/AppData/Local/Programs/Python/Python36-32/s.py", line 12, in <module> main() File "C:/Users/john/AppData/Local/Programs/Python/Python36-32/s.py", line 8, in main sum=sum+eval(line) File "<string>", line 1 ^SyntaxError: unexpected EOF while parsing哪里出错了?是sum哪里吗,为什么错了?
添加回答
举报
0/150
提交
取消