Given the dictionary x={‘k1’:’v1’, ‘k2’:’v2’, ‘k3’: ‘v3’, ‘k4’: ‘v4’}
Create a dictionary of opposite mapping, like x={’v1’ : ’k1’, ‘v2’ : ’k2’, ’v3’ : ’k3’,’v4’: ‘k4’}
Answers
Answered by
1
x = {"k1":"v1", "k2":"v2", "k3": "v3", "k4": "v4"}
y = {v: k for k, v in x.items()}
print(y)
Answered by
0
Answer:
x = {"k1":"v1", "k2":"v2", "k3": "v3", "k4": "v4"}
y = {v: k for k, v in x.items()}
print(y)
Similar questions
Math,
2 months ago
English,
2 months ago
Environmental Sciences,
2 months ago
Math,
4 months ago
English,
4 months ago
Political Science,
10 months ago
Math,
10 months ago
English,
10 months ago