It's easier than you think:
for i in B:
if i in A:
print("yes")
This assumes that both A and B are lists, but you seem to have dictionaries/sets. You might need to clarify that first. If you have sets, the above solution should still work.
Edit: you now say that both A and B are columns from two separate DataFrames. In that case you can do:
A={"sara", "peter", "ray"}
B={"ram", "sara", "gouri"}
df1 = pd.DataFrame(A, columns=['Names'])
df2 = pd.DataFrame(B, columns=['Names'])
for index, row in df1.iterrows():
if row['Names'] in df2.Names.tolist():
print('yes')
Edit 2: you now say that you want to add the result to a new column in df2. Use:
A={"sara", "peter", "ray"}
B={"ram", "sara", "gouri"}
df1 = pd.DataFrame(A, columns=['Names'])
df2 = pd.DataFrame(B, columns=['Names'])
df2['present_in_df1'] = np.where(df1['Names'] == df2['Names'], "yes", "no")
Output df2
:
Names present_in_df1
0 gouri no
1 ram no
2 sara yes