Say I have two lists:
list1=[a,b,c,d,e,f,a,b,c]
list2=[a,c,d]
How could I compare list1 and list2 such that I would get an output like:
list3=[match,-,match,match,-,-,-,-,-]
So that it goes in order
Here's my code:
h=[]
for i in range(len(change2)):
for j in range(len(atom)):
if atom[j]==atom[i]:
h.append("H")
else:
h.append("-")
print h
Both change2 and atom have letters with a particular order. atom has 479 letters and change2 has 188 letters. I want an output that is a list with 479 elements. I want to scan through atom until the first element is found in change2. I want the list to have elements "H" if they match and "-" if they do not. My code is giving me a huge list! I'm not sure how to make it ordered.
Thanks!