+ 1
[SOLVED] Eof error
I am trying to input a matrix of arbitrary length(in my case: 1 2 \n 3 4) and receive "EOFError: EOF when reading a line". What's wrong? matrix = [] while True: s = input() if not s: break matrix.append(s) print(matrix)
3 ответов
+ 2
matrix = []
while True:
try:
s = input()
except :
break
matrix.append(s)
print(matrix)
At last, You need to press empty enter at least to your program work without error.. And this is alternative.. It works as you expecting....
+ 3
You need to provide all the inputs on sololearn at once since it's not interactive
+ 1
Thank you!