JOIN
Get Time
forums   
Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings
View: Flat (newest first)  | Threaded  | Tree
TypeError: 'int' object has no attribute '__getitem__' for div2 250 problem using Python | Reply
What's wrong with my code? Greed 2.0 can run the test cases with success and I was also able to test with success in the interactive shell. If I do bach testing I always get the error:
TypeError: 'int' object has no attribute '__getitem__'
and if I run the system tests it won't even run the first one, it exits with abnormal termination.
I use Python3. Does TopCoder not support python fully?

def countWays(self, h):
        my_set = set()
        for i in range(len(h)):
            t = h[:i] + h[i+1:]
            my_set.add(tuple(i for i, h in sorted([(i, h) for i, h in enumerate(t)], key=lambda x: x[1], reverse=True)))
 
        return len(my_set)
Re: TypeError: 'int' object has no attribute '__getitem__' for div2 250 problem using Python (response to post by plx) | Reply
You may find the answer by checking "'int' object has no attribute '__getitem__'" in google search engine.

I found some useful (looks like useful) information about this.
Re: TypeError: 'int' object has no attribute '__getitem__' for div2 250 problem using Python (response to post by square1001) | Reply
It runs with Python3. Is TopCoder expecting Python2?
Re: TypeError: 'int' object has no attribute '__getitem__' for div2 250 problem using Python (response to post by plx) | Reply
Try it assuming python2.
RSS