[Solved] How to multiply dictionary keys? [duplicate]


I believe you want is:

Multiply each key with 2. Not the square of it.

d = {2: (1,2), 8: (2,4), 30: (10,3)}
d = {k*2: v for (k, v) in d.items()}
print(d)

OUTPUT:

{4: (1, 2), 16: (2, 4), 60: (10, 3)}

solved How to multiply dictionary keys? [duplicate]