• + 0 comments

    I had to switch the language to python 2 and use raw_input() instead of input() to get it to work. It seems that the hash function works differently in python 3 than it did in python 2, which is likely the version of python this challenge was written for. HackerRank really needs to update this challenge for python 3!

    This is my python 2 code I used:

    # read the count (not really used except to know how many)
    n = int(raw_input())
    
    # read the line of numbers as text, split on spaces, map to int, pack into a tuple
    elements = tuple(map(int, raw_input().split()))
    
    # compute and print the hash
    print hash(elements)
    

    compute and print the hash

    print hash(elements)