tests_dict = {'test 1': ['Manuel', 'Mariana', 'Filipa'], 'test 2': ['Manuel', 'Filipa', 'Mariana'], 'test 3': ['Mariana', 'Manuel', 'Filipa']}
peps_dict = {}
for test in tests_dict:
for indx, name in enumerate(tests_dict[test], 1):
if name not in peps_dict:
peps_dict[name] = {}
peps_dict[name][test] = indx
print(peps_dict)
dGVzdHNfZGljdCA9IHsndGVzdCAxJzogWydNYW51ZWwnLCAnTWFyaWFuYScsICdGaWxpcGEnXSwgJ3Rlc3QgMic6IFsnTWFudWVsJywgJ0ZpbGlwYScsICdNYXJpYW5hJ10sICd0ZXN0IDMnOiBbJ01hcmlhbmEnLCAnTWFudWVsJywgJ0ZpbGlwYSddfQoKcGVwc19kaWN0ID0ge30KZm9yIHRlc3QgaW4gdGVzdHNfZGljdDoKICAgIGZvciBpbmR4LCBuYW1lIGluIGVudW1lcmF0ZSh0ZXN0c19kaWN0W3Rlc3RdLCAxKToKICAgICAgICBpZiBuYW1lIG5vdCBpbiBwZXBzX2RpY3Q6CiAgICAgICAgICAgIHBlcHNfZGljdFtuYW1lXSA9IHt9CiAgICAgICAgcGVwc19kaWN0W25hbWVdW3Rlc3RdID0gaW5keApwcmludChwZXBzX2RpY3Qp
{'Manuel': {'test 1': 1, 'test 3': 2, 'test 2': 1}, 'Filipa': {'test 1': 3, 'test 3': 3, 'test 2': 2}, 'Mariana': {'test 1': 2, 'test 3': 1, 'test 2': 3}}