orders = [3, 2, 5, 1]
orders.sort(reverse = True)
A = []
B = []

for i in orders:
    if sum(A) <= sum(B):
        A.append(i)
    else:
        B.append(i)

print(max(sum(A),sum(B)))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: