Pergunta de entrevista da empresa Meta

Find common words in 2 sentences

Respostas da entrevista

Sigiloso

1 de ago. de 2020

sent_1 = 'A blue whale is whale which is blue' sent_2 = 'The blue ocean has whales which are blue' list_1 = sent_1.split() list_2 = sent_2.split() for i in list_1: if i in list_2: print(i) break

Sigiloso

6 de ago. de 2020

s1 = 'The blue whales are a whale which is blue.' s2 = 'The blue ocean has whales which are blue.' l1 = s1.split() l2 = s2.split() for i in l1: if i in l2: print(i) #Output The blue whales are which blue.