JOIN
Get Time
forums   
Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings
View: Flat  | 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)
Subject Author Date
TypeError: 'int' object has no attribute '__getitem__' for div2 250 problem using Python plx Dec 4, 2017 at 5:56 AM EST
Re: TypeError: 'int' object has no attribute '__getitem__' for div2 250 problem using Python square1001 Dec 5, 2017 at 6:55 AM EST
Re: TypeError: 'int' object has no attribute '__getitem__' for div2 250 problem using Python plx Jan 13, 2018 at 11:17 AM EST
Re: TypeError: 'int' object has no attribute '__getitem__' for div2 250 problem using Python square1001 Jan 14, 2018 at 2:38 AM EST
RSS