I have two list listOne & listTwo
e.g.
listOne could contain 'about', 'day', 'school'
listTwo could contain 'a','c','da','z'
I want to find out all the elements in listOne which start with characters from elements in listTwo. The output with above example is 'about' and 'day'
I try to implement it with following code:
for elem1 in listTwo:
for elem2 in listOne:
if elem2.startswith(elem1):
result.append(elem2)
but I feel it nested too much. Is there a more elegant way to achieve it in Python?