I have two lists, master_list, and list_to_be_compared, found the solution to compare lists on python, and it was working for me, but I can't store the output of that inside another list.
master_list = ['n0', 'n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'n7', 'n8', 'n9', 'n10', 'n11', 'n12', 'n13', 'n14', 'n15', 'n16', 'n17', 'n18', 'n19']
list_to_be_compared = ['n1', 'n3', 'n7', 'n8', 'n9', 'n16', 'n17', 'n18']
#TRIAL 1
party = []
party.append(list(set(master_list).intersection(set(list_to_be_compared))))
print(party)
#TRIAL 2
party = list(set(master_list).intersection(set(list_to_be_compared)))
print(party)
It is giving me this output
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-258-3472dc1f0a25> in <module>
----> 1 print(party)
TypeError: 'NoneType' object is not callable
When I just run the file, I am getting the items that are intersecting with the master_list, but how to store it in a list? Thanks for your help :)