HackerRank Tuples Solution in Python

HackerRank Tuples Solution in Python

Given an integer, , and  space-separated integers as input, create a tuple, , of those  integers. Then compute and print the result of .

Note: hash() is one of the functions in the __builtins__ module, so it need not be imported.

Input Format

The first line contains an integer, , denoting the number of elements in the tuple.
The second line contains  space-separated integers describing the elements in tuple .

Output Format

Print the result of hash(t).

Sample Input 0


1 2

Sample Output 0


Solution in Python3

n = int(input())
int_list = [int(i) for i in input().split()]
int_tuple = tuple(int_list)

Subscribe to The Poor Coder | Algorithm Solutions

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]