You could turn it around:
>>> d1 = {"yes": [1,2,3], "no": [4]}
and then “invert” that dictionary:
>>> d2 = {value:key for key in d1 for value in d1[key]}
>>> d2
{1: 'yes', 2: 'yes', 3: 'yes', 4: 'no'}
You could turn it around:
>>> d1 = {"yes": [1,2,3], "no": [4]}
and then “invert” that dictionary:
>>> d2 = {value:key for key in d1 for value in d1[key]}
>>> d2
{1: 'yes', 2: 'yes', 3: 'yes', 4: 'no'}