How To Match Elements Of Two Lists And Access Their Indexes
i want to match elements from a list and append the next index after match in an array list but in my code it is giving me an empty array.I dont know where the problem is. in my co
Solution 1:
Most probably you need this :
arr = []
result=['Alphabets','reveals','help','opinions','Allah']
words=['Alphabets',"1",'reveals',"2",'help',"3",'opinions',"4",'Allah',"5"]
for j in range(0, len(words)):
if words[j] in result:
arr.append(words[j+1])
print(arr)
If not please add some shorter code and expected output
, that will help to understand
Post a Comment for "How To Match Elements Of Two Lists And Access Their Indexes"