For example I have 2 variables:
a = 2 + 2
b = 3 + 3
And now I want to construct a dictionary where keys are variable names, that is “a”, “b” and values are 4 and 6 accordingly.
{x: x for x in (a, b)}
# --→ {4: 4, 6: 6}
Question is that I don't know how to make keys “a” and “b” instead of 4 and 6. str(), str doesn't work. Each time x as a key gets evaluated and becames 4 or 6
Desirable output would be
{a: 4, b: 6}
Thank you!