我正在尝试解决https://practice.geeksforgeeks.org/contest-problem/sahil-love-good-scorer/0/问题,并得到以下错误,尽管此代码在其他集成开发环境中运行良好
Runtime Error:
Runtime ErrorTraceback (most recent call last):
File "/home/6571cce4dcc6723ee2dba6c01da8240c.py", line 3, in <module>
m=list(map(int,input().split()))
EOFError: EOF when reading a line下面是我的代码:
n=int(input())
while n!=0:
m=list(map(int,input().split()))
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
s1=sum(l1)
s2=sum(l2)
if s1>s2:
print('C1')
else:
print('C2')我做错了什么,有谁能帮帮我。
发布于 2019-12-23 19:01:11
看起来您使用的是python 2。如果是这样,这应该是可行的:
n = int(raw_input("enter n: "))
while n != 0:
m = list(map(int, raw_input("enter m : ").split()))
l1 = list(map(int, raw_input("enter l1: ").split()))
l2 = list(map(int, raw_input("enter l2: ").split()))
s1 = sum(l1)
s2 = sum(l2)
if s1>s2:
print('c1')
else:
print('c2')你可能也会发现这个答案很有用:Python EOF error when reading input
然而,我无法使用python3.6重现这个错误。
https://stackoverflow.com/questions/59451620
复制相似问题