fork download
  1. tests_dict = {'test 1': ['Manuel', 'Mariana', 'Filipa'], 'test 2': ['Manuel', 'Filipa', 'Mariana'], 'test 3': ['Mariana', 'Manuel', 'Filipa']}
  2. 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)}
  3. print(peps_dict)
Success #stdin #stdout 0.01s 9992KB
stdin
Standard input is empty
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}}