0

Substring query

words = ["spam", "egg", "spam", "sausage"] mwords= ["spam", "eggs"] print(mwords in words) Why above code returns 'False'?

24th Aug 2020, 12:30 PM
Divya
2 Answers
+ 5
It gives false because you've queried for an array i.e ["spam", "eggs"] which is not in words. You could query for either spam or eggs separately then you'd get true.
24th Aug 2020, 12:47 PM
Takudzwa Nelson Chiutaalenga
Takudzwa Nelson Chiutaalenga - avatar