'NoneType' object has no attribute 'append' python

Published: 5/10/2017
'NoneType' object has no attribute 'append' python

I run the following code: import sys def find_common(a,b,c): d=[] for i in a: if i in b: d=d.append(i) for i in d: if i not in c: c=c.append(i) print(c) return c if __name__ == '__main__': a=[1,1,2,4] b=[2,2,3,4] c=[] find_common(a,b,c) sys.exit() but get the following error: d=d.append(i) AttributeError: 'NoneType' object has no attribute 'append' Why is it happening? Please help to fix it.

Read more
Related news