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.
- Prepare
- Python
- Basic Data Types
- Tuples
- Discussions
Tuples
Tuples
Sort by
recency
|
1771 Discussions
|
Please Login in order to post a comment
This problem is a great way to practice working with tuples and the hash() function in Python. By converting the list of space-separated integers into a tuple and then using hash(), Ekbet 71 login
first choose python version 2 this problem is only solveable in python version2
if name == 'main': n = int(raw_input()) integer_list = map(int, raw_input().split()) t=(tuple(integer_list)) print(hash(t))
Must choose Language = Python 2 for the hash to pass the test.
Change the version to python 2 in the editor and run your code the test case will be passed. If you try in python 3 there output will vary.
I can't understand what is wrong with my code? if name == 'main': n = int(input()) a=input().split() tup=tuple(a) print(hash(tup))