PCYCLE Getting Run time error NZEC

Here is a link to my python code CodeChef: Practical coding for everyone
I don’t know why I am getting NZEC for this code. It is just working fine on my system.
Could anyone please point out my mistake?

Edit:

Assuming you mean CodeChef: Practical coding for everyone, I get:

[simon@simon-laptop][06:02:20]
[~/devel/hackerrank/otherpeoples]>echo "4                
1 2 4 1
3 5 7 3
6 6
8 8 " | ./rajat004-PCYCLE.py
Traceback (most recent call last):
  File "./rajat004-PCYCLE.py", line 10, in <module>
    cycle.append(str(a[p-1]))
TypeError: 'map' object is not subscriptable

when trying to run the sample testcase locally using Python 3.6 on my local machine, which sounds like this.

I’m not a Python guy, though, and I get a different error with Python 2.

1 Like

I am really sorry. I didn’t notice and accidentally put the wrong link.
The right link is that CodeChef: Practical coding for everyone.

1 Like

Ok, I got where I was wrong. I was not converting map object into list after taking the input.

map(int, input().split())

It should be like this

list(map(int, input().split()))

obviously You can not access the elements of a map object the same way You can do with list object. It was a silly mistake :sweat_smile:

1 Like