Tuples in Python - Hacker Rank Solution

Problem Statement :

Task:

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

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, n, denoting the number of elements in the tuple.

The second line contains n space-separated integers describing the elements in tuple t.


Output Format:

       Print the result of hash(t).


Solution:

 if __name__ == '__main__':
    n = int(input())
    integer_list = map(int,input().split())
    integer_list=tuple((integer_list))

    print(hash(integer_list))



Disclaimer:- 

The above hole problem statement is given by hackerrank.com but the solution is generated by the Hackerranksolution.site authority if any of the queries regarding this post or website fill the following contact form thank you.
Next Post Previous Post
No Comment
Add Comment
comment url