I have a dict and a list like this:
hey = {'2': ['Drink', 'c', 'd'], '1': ['Cook', 'a']}
temp = ['Cook', 'a']
I want to check if temp
is present in hey
. My code:
def checkArrayItem(source,target):
global flag
flag = True
for item in source:
if (item in target):
continue
else:
flag = False
break
for i,arr in enumerate(hey) :
if (len(temp) == len(hey[arr])):
checkArrayItem(temp,hey[arr])
if (flag):
print('I got it')
break
What is a more elegant way to do this check?