input EOF error

x=int(input()) y=int(input()) z=[[0 for row in range(0,x)] for col in range(0,y)] for i in range (x): for j in range (y): z[i][j]=input() for i in range (x): for j in range (y): print(z[i][j],end=' ') print("\n") this was my original code to accept the matrix from user and to print back the matrix in order and i was encountered with an error Traceback (most recent call last): File "..\Playground\", line 6, in <module> z[i][j]=input() EOFError: EOF when reading a line

17th Sep 2017, 2:49 PM
yagami light
yagami light - avatar
1 Answer
+ 8
It should work alright outside SoloLearn. The error is most likely caused by the Code Playground's way of accepting input -- you have to enter all expected input at once, separating it with a newline. Otherwise, the code will fail as it expects more input than you have provided. Try the following input: 1 1 5 It should then print out 5, as it will create a 1x1 matrix and expect just one more input.
17th Sep 2017, 3:01 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar