Jan-13-2019, 12:07 PM
Hello, I need your help. I have to write a function which returns True or False according to the equality between a dictionnary and a list.
For example :
l = [[0, 2, 4], [4, 1, 0]]
d = {(0,1): 2, (0,2): 4, (1,0): 4, (1,1): 1}
In this case, function must return True. But when I turn the first key into (0,2) it returns True once again instead of False.
Here is my code :
For example :
l = [[0, 2, 4], [4, 1, 0]]
d = {(0,1): 2, (0,2): 4, (1,0): 4, (1,1): 1}
In this case, function must return True. But when I turn the first key into (0,2) it returns True once again instead of False.
Here is my code :
def equal(l,d) : for key in d : if d[key] == l[key[0]][key[1]] : return True else : return False