fork download
  1. tests_dict = {'test 1': ['Manuel', 'Mariana', 'Filipa'], 'test 2': ['Manuel', 'Filipa', 'Mariana'], 'test 3': ['Mariana', 'Manuel', 'Filipa']}
  2.  
  3. peps_dict = {}
  4. for test in tests_dict:
  5. for indx, name in enumerate(tests_dict[test], 1):
  6. peps_dict.setdefault(name,{})[test] = indx
  7. print(peps_dict)
Success #stdin #stdout 0.02s 9992KB
stdin
Standard input is empty
stdout
{'Mariana': {'test 3': 1, 'test 1': 2, 'test 2': 3}, 'Manuel': {'test 3': 2, 'test 1': 1, 'test 2': 1}, 'Filipa': {'test 3': 3, 'test 1': 3, 'test 2': 2}}