Apr-08-2020, 05:01 PM
(This post was last modified: Apr-08-2020, 05:01 PM by deanhystad.)
Why did you change the code to create new_dict outside of check()? Why do you insist on not returning an empty diction while insisting that returning an empty dictionary is what the code should do when it finds a duplicate name?
def check(seq): new_dict = {} for i in seq: for j in seq: if (j!=i and (i['numero'] == j['numero'])): print('Dupicate, I['numero']) return {} else: (key, value), *rest = i.items() new_dict[value] = dict(rest) return new_dict