l = [(1, 4), (2, 4), (3, 4), (4, 15), (5, 15), (6, 23), (7, 23), (8, 23), (
    9, 15), (10, 23), (11, 15), (12, 15)]
d = defaultdict(list)
for v, k in l:
    d[k].append(v)
d
[{k: d[k]} for k in sorted(d)]
PYTHON: Converting list of tuples into a dictionary