1 / 4
Sep 2018

Guys I have NZEC error in my code. Do you know how to solve NZEC in for loop or some other solutions?
Anybody helps me pleaseeeee…
lst = []
n = int(input())
for i in range(n):
lst.append(input())
for j in range(n):
print(lst[j])

  • created

    Sep '18
  • last reply

    Sep '18
  • 3

    replies

  • 928

    views

  • 2

    users

  • 1

    like

I made some assumptions about the indentation, but I don’t get an NZEC when I run your code, so perhaps it depends on the test data. What values did you use?

Hmmm…
I just want to input n numbers in a single line split by a space. Do you know how to do it?

I’ve not done much Python coding, so there may be better ways, but this is what I came up with.

import sys
lst = [int(x) for x in sys.stdin.readline().split()]
n = int(lst[0])
del lst[0]
print(*lst)