a = [1,2,3,4,5]
b = [4,5,6,7,8]
result = []

for i in a:
    if i not in b:
        result.append(i)

for i in b:
    if i not in a:
        result.append(i)

result.sort()
print(result)

Embed on website

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