We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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 tupleelements=tuple(map(int,raw_input().split()))# compute and print the hashprinthash(elements)
compute and print the hash
print hash(elements)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tuples
You are viewing a single comment's thread. Return to all 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:
compute and print the hash
print hash(elements)