I have trouble understanding the solution code, so I did the below code based on my understanding but error showed. I think the problem is at line 6-8. Solution code has list comprehension, but I want to use the for loop here. How to fix my code?
question_overlap= terms_used=set() df.sort_values(by='Air Date',ascending=True,inplace=True) for i,row in df.iterrows(): split_question=row['clean_question'].split() for i in split_question: if len(i) < 6: i.remove() match_count=0 for item in split_question: if item in terms_used: match_count+=1 if len(split_question)>0: match_count=match_count/len(split_question) question_overlap.append(match_count)