我想跳過空白行(沒有用戶輸入的值)。我得到這個錯誤。如何在用戶輸入python時跳過空行?
Traceback (most recent call last):
File "candy3.py", line 16, in <module>
main()
File "candy3.py", line 5, in main
num=input()
File "<string>", line 0
^
SyntaxError: unexpected EOF while parsing
我的代碼是:
def main():
tc=input()
d=0
while(tc!=0):
num=input()
i=0
count=0
for i in range (0, num):
a=input()
count=count+a
if (count%num==0):
print 'YES'
else:
print 'NO'
tc=tc-1
main()
你運行的Python的版本? – Sam