my_dict = {'one': 1, 'two': 2, 'three': 3}
my_keys = ['three', 'one','ten','one']
solutions = []
for key,value in my_dict.items():
found = False
for i in my_keys:
if i in key:
solutions.append(value)
found = True
break
if not found:
solutions.append('Nan')
I get this output:
['Nan', 1, 'Nan', 'Nan', 'Nan', 'Nan', 3]
but the expected output is:
Output: ['3', '1', 'Nan', '1']
How can I get the expected output?