data1 = "1010"
data2 = "1011"
answer = 0
total = 0

for i in range(len(data1)):
    if data1[i] == "1":
        total += 2 ** (len(data1) - 1 - i)
for i in range(len(data2)):
    if data2[i] == "1":
        total += 2 ** (len(data2) - 1 - i)

for i in range(total):
    if total - 16 >= 0:
        total -= 16
        answer += 10000
    if total - 8 >= 0:
        total -= 8
        answer += 1000
    if total - 4 >= 0:
        total -= 4
        answer += 100
    if total - 2 >= 0:
        total -= 2
        answer += 10
    if total - 1 >= 0:
        total -= 1
        answer += 1
    
print(answer)

Embed on website

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