Problem in code

a={2,5,6,9}
b={2,5,7,8}
c=sorted(a.difference(b))
d=sorted(b.difference(a))
e=[]
for i,j in c,d:
    e=e.append(i)
    print(e)

Why append function is not working ?

.append() adds to the list in memory.

.append() doesn’t return anything. Why should .append() return anything?

1 Like