I'm trying to create a function that takes a dictionary whose values are tuples, and a separate tuple as arguments, after which I am trying to compare between their index values as demonstrated below. If they match the key should be entered into a new dictionary.
I've been trying to use tuple unpacking and I'm not sure what I'm doing wrong (new to Python):
some_dict = {"a" : (1,2,3), "b" : (1,4,5), "c" : (2,2,3)}
some_tuple = (1,2,5)
def function (some_dict, *some_tuple):
another_dict = {"match" : [], "no_match" : []}
some_tuple = list(some_tuple)
for item in some_dict.values():
if some_dict[item][0] == some_tuple[0]:
another_dict["match"].append(item)
else:
another_dict["no_match"].append(item)
return another_dict