S = ['cat','tor','tutorial','item','aba','tori']
T = "oti"
for item in S:
for i in item:
if i in T:
print(item)
I want to get 'tori' and 'tutorial' because those are the 2 words that contain o
, t
, i
. The code above will print everything from the list. Using find() is not an option because there is no match.
Will using match be a good option here? I could use some hint here. Thanks in advance.