'Check if list of four elements has two pairs of equal numbers in Python

I was solving this problem on codesignal:

Call two arms equally strong if the heaviest weights they each are able to lift are equal.

Call two people equally strong if their strongest arms are equally strong (the strongest arm can be both the right and the left), and so are their weakest arms.

Given your and your friend's arms' lifting capabilities, find out if you two are equally strong.

I was able to find this solution and it worked on all tests. Can someone please help me find a shorter solution? I think mine is way too long. Thanks

def solution(yourLeft, yourRight, friendsLeft, friendsRight):

    lst_me = []
    lst_me.append(yourLeft)
    lst_me.append(yourRight)
    lst_me = sorted(lst_me)

    lst_friend = []
    lst_friend.append(friendsLeft)
    lst_friend.append(friendsRight)
    lst_friend = sorted(lst_friend)


    if lst_me[0] == lst_friend[0] and lst_me[1] == lst_friend[1]:
        return True
    else:
        return False


Solution 1:[1]

Put each pair of arms into an unordered collection (like a set) and compare those:

def solution(yourLeft, yourRight, friendsLeft, friendsRight):
    return {yourLeft, yourRight} == {friendsLeft, friendsRight}
>>> solution(100, 120, 120, 100)
True
>>> solution(100, 100, 120, 100)
False
>>> solution(100, 100, 100, 100)
True

Since equality comparisons between sets are order-insensitive, there's no need to sort them before doing the comparison. {x, y} == {y, x}.

Note that this solution wouldn't work if it had to handle three arms, because {x, x, y} == {x, y, y} as well! If you had a restriction like this that prevented you from using sets, a shorter way of doing the comparison between sorted lists would be:

def solution(yourLeft, yourRight, friendsLeft, friendsRight):
    return sorted([yourLeft, yourRight]) == sorted([friendsLeft, friendsRight])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1