My Third Hackerrank Star




Today I got my third Star on Hackerrank. I got this by solving a simple problem based on the tuple, which I solved with the help of google. I was not sure how to convert a list into a tuple. So only that part I searched.

Here is the source code of the problem I solved today:


1)Tuple
if __name__ == '__main__':
n = int(input())
integer_list = map(int, input().split())
my_number_list = []
i = 0
for integer in integer_list:
my_number_list.append(integer)
my_tuple = tuple(my_number_list)
print(hash(my_tuple))
2)Find Runner up Score


if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
list = []
for x in arr:
# print(x)
list.append(x)
# print(list)
i = 0


sorted_list = sorted(list,reverse=True)

# print(sorted_list)
for t in sorted_list:
if t == max(sorted_list):
continue
else:
print(t)
break



#NOTE:
Give more description to these things.













































Comments

Popular posts from this blog

Got first Freecodecamp certificate.