• + 0 comments

    hello hackerrank citizens, this is my answer using python, can I upgrade the code to make it more efficient and clean?

    def breakingRecords(scores): batas_atas = scores[0] batas_bawah = scores[0] best = [] worse = []

    for score in scores:
        if (score > batas_atas):
            best.append(score)
            batas_atas = score
    
        elif (score < batas_bawah):
            worse.append(score)
            batas_bawah = score
    
    result = [len(best), len(worse)]
    
    return result;