Find the Runner-Up Score!

  • + 0 comments

    #find the second hight score number #print it out

    #First do list of all of elements
    arr = list(arr)
    arr.sort()
    #print(arr)
    
    #remove duplicates
    uniuque_elements = set(arr)
    #print(uniuque_elements)
    
    #find the second hight score number
    max_value = max(uniuque_elements)
    
    uniuque_elements.remove(max_value)
    #print(uniuque_elements)
    

    Something I got confused about while working on this problem was actually understanding what the term "runner-up score" means. This was a bit confusing for me. The second thing I wasn't sure about was how to create a list for the "arr." However, in the end, I understood that we do need to have a list. But did we convert the "arr" to a list?

    print(max(uniuque_elements))