Compare the Triplets

  • + 0 comments

    I hope that my solution can help you:

    def compareTriplets(a,b):
        alicePoints = 0 # a
        bobPoints = 0   # b
        comparisonPoints = []
    
        for i in a:
            for j in b:
                # If each element of the list a and b, are greater than 1 and less than 100
                if(1 <= i <= 100) & (1 <= j <= 100):
    						# We proceed to compare the points
    						# If the index of the list a is equal to the index of the list b
                    if (a.index(i) == b.index(j)):
                        if (i > j):
                            alicePoints += 1
                        if (i < j):
                            bobPoints += 1
    
        comparisonPoints.append(alicePoints)
        comparisonPoints.append(bobPoints)
    
        return comparisonPoints