match 2 dictionary with python and check both key and value

49 Views Asked by At

I am matching 2 dictionaries with their keys and values but after giving it same items the output is coming false, I have to check it both key and value and if its true it should print true or givr the matching key and value, I am trying many solutions but unable to get the results, I need some suggestions and explanations since I am new in dictionary python, Thanks in advance

   first_dict  ={'a':['apple']} 
   second_dict ={'a':['apple','banana'],'b':['mango','orange']}
##first solution which I have tried
 val= all(first_dict[k] == v for k, v in second_dict.items() if k in first_dict)
 print(val)   ## this is always coming false,

##second solution which I have tried
##even I have try this:

for key,value in set(second_dict.items()) and set(first_dict.items()) 
 print("the items are",key,value)
0

There are 0 best solutions below