May-11-2017, 12:27 PM
I have a dictionary to people's names and codes,like this:
Names_and_codes = {"Emily":30623, 'Ethan':21298, "Chloe":40145, "Olivia":61834, "Daniel":51398, "William":82523, "Emma":70623}And I have a list of codes,like this :
codes =[[30623 ,70623], [61834 ,40145], [51398, 21298], [21298 ,40145], [61834 ,82523], [21298, 82523]]The first number in list is the parents number and the second children's number...I need to find my parents and their kids,And put them in a new dictionary... like this:
new_dic = {'Ethan': {'Chloe', 'William'}, 'Olivia': {'Chloe', '"William'}, 'Daniel': {'Ethan'}, 'Emily': {'Emma'}}