I have a list as below:
fruits_exclude = ['grapes', 'banana', 'apple']
I have two dictionaries as below:
fruits_have = {'apple': 3, 'banana': 4, 'mango': 5, 'grapes': 5}
final_dict = {}
I want to move the item 'mango': 5
into final_dict
.
I am trying to do it in python, but things are not working:
if list(fruits_have.keys()) not in fruits_exclude:
#copy the key and value pair (item) into final_dict
Could someone help me with this?