1
我已經編寫了解決問題的代碼。Python 3錯誤:ValueError:int()與基數爲10的無效文字:''
這裏是我的代碼:
t=int(input())
print("")
while(t):
s=0
n=int(input())
for i in range(n):
no=int(input())
s=s+no
if s%n==0:
print("YES")
else:
print("NO")
print("")
t-=1
當我在OS X終端上運行它,它工作正常。但是,當我在IDEone
運行,或將其提交的解決方案,它提供了有關line 5
錯誤:
ValueError: invalid literal for int() with base 10: ''
我不確定的是什麼問題。
那麼也許你應該在嘗試將'input'轉換爲'int'之前檢查'input'的結果。 –