i am doing a question . i have written a simple python code and still its showing NZEC error
n=int(input()) /"error is pointing in this line showing invalid literal for int with base 10 "
k=int(input())
A=[]
for _ in range(n):
A.append(input())
for x in range(n):
if(A[x]%k==0):
print(A[x])
Check the custom input box and provide the input according to your questions then try to run it. In codechef it doesn’t take input automatically if you click on the run button.
On 1 st line he is trying to read a line of input but during runtime it getting EOF as a input because he has not provided any input to the program in the custom input box. If he provide the input in custom input box properly and k≠0 then the program will work fine.
Your code will work only for the input of bellow formation:
6
2
1
2
3
4
5
6
Because input() function scan whole line.
Now for your given input in first input() function it scan “6 2”.
We can’t convert “6 2” into integer so it will genarate error.
If you want to take input like you have mentioned then use the above snippet of code mentioned by @ssjgz