Compare the Triplets

  • + 9 comments

    Very easy to understand but you might want to use some python features, i.e., list comprehension

    def solve(a0, a1, a2, b0, b1, b2):
        A = [a0, a1, a2]
        B = [b0, b1, b2]
        
        C = sum([1 if x[0] > x[1] else 0 for x in zip(A,B)])
        D = sum([1 if x[1] > x[0] else 0 for x in zip(A,B)])
    
        return (C, D)