How do I remove square brackets while printing list element

  Kiến thức lập trình

#I am trying to print runner up score. but the problem is, it is showing the output is in squarebracket in #hackerrank. I tried with replace method, for loop.

n = input() [input is in terms like: 1 2 3 4]
arr = [int(i) for i in n.split(" ")]
arr.sort(reverse = True)
print (arr)
counter = arr.count(arr[0])
if counter > 1:
    print(arr[counter])
else:
    print(arr[1])

Replace method and for loop

New contributor

Krish Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT