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
|
1739 Discussions
|
Please Login in order to post a comment
if name == 'main': n = int(input()) string_list=input().split() int_list=[int(string_list[i]) for i in range(n)] t=tuple(int_list) print(hash(t)) One who is wondering use of n variable, it can be used as above for string to int conversion.
if name == 'main': n = int(input()) integer_list = map(int, input().split())
I don't know how to pass this test.... this is my code:
While this problem provides n as input, it's not actually needed in the solution. This longer version of the code is provided as an alternative for programmers who aren't yet comfortable using map() and prefer a more step-by-step approach.
if name == 'main':
HackerRank relies on Pypy and its hash() algorithm. You should've mentioned it in the problem facts. Either adapt your Python environment to use its own hash() or state this in the problem ducuments. Lots of time wasted on a technical mistake!!