A = [1, 1, 1, 6, 0]
B = [2, 7, 8, 3, 1]

A.sort()
B.sort(reverse=True)

result = 0
for i in range(len(A)):
    result += A[i] * B[i]

print(result)

Embed on website

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