tests_dict = { 'test 1' : [ 'Manuel' , 'Mariana' , 'Filipa' ] , 'test 2' : [ 'Manuel' , 'Filipa' , 'Mariana' ] , 'test 3' : [ 'Mariana' , 'Manuel' , 'Filipa' ] }
peps_dict = { n: { test : tests_dict[ test ] .index ( n) + 1 for test in tests_dict if n in tests_dict[ test ] } for n in ( name for listN in tests_dict.values ( ) for name in listN) }
print ( peps_dict)
dGVzdHNfZGljdCA9IHsndGVzdCAxJzogWydNYW51ZWwnLCAnTWFyaWFuYScsICdGaWxpcGEnXSwgJ3Rlc3QgMic6IFsnTWFudWVsJywgJ0ZpbGlwYScsICdNYXJpYW5hJ10sICd0ZXN0IDMnOiBbJ01hcmlhbmEnLCAnTWFudWVsJywgJ0ZpbGlwYSddfQpwZXBzX2RpY3QgPSB7bjoge3Rlc3Q6IHRlc3RzX2RpY3RbdGVzdF0uaW5kZXgobikgKyAxIGZvciB0ZXN0IGluIHRlc3RzX2RpY3QgaWYgbiBpbiB0ZXN0c19kaWN0W3Rlc3RdfSBmb3IgbiBpbiAobmFtZSBmb3IgbGlzdE4gaW4gdGVzdHNfZGljdC52YWx1ZXMoKSBmb3IgbmFtZSBpbiBsaXN0Til9CnByaW50KHBlcHNfZGljdCk=
stdout
{'Manuel': {'test 1': 1, 'test 2': 1, 'test 3': 2}, 'Filipa': {'test 1': 3, 'test 2': 2, 'test 3': 3}, 'Mariana': {'test 1': 2, 'test 2': 3, 'test 3': 1}}