I have a Python dictionary containing recipes. I have to find key values inside it and then return results depending on where those keys where found.
recipes = {
'recipe1':{
'name': 'NAME',
'components': {
'1':{
'name1':'NAME',
'percent':'4 %'
},
'2':{
'name2':'NAME',
'percent':'3 %'
},
'3':{
'name3':'NAME',
'percent':'1 %'
},
},
'time':'3-5 days',
'keywords':['recipe1', '1','etc']
}
}
Each recipe has a list of keywords
. How can I lookup a recipe based on its keywords
and some search input? Upon finding a recipe, I would need to return the name components and time that are specific for that recipe.