Q. Given the dictionary x = {‘k1’: ‘v1’, ‘k2’ : ‘v2’, ‘k3’ : ‘v3’} ,create a dictionary with the opposite mapping.
Write a program to create the dictionary.
You can understand by Watching video :-
Answer :-
x = { "k1" : "v1" , "k2" : "v2", "k3" : "v3"} dic = { } for i in x : dic [ x[ i ] ] = i print(dic)
Output :-
{'v1': 'k1', 'v2': 'k2', 'v3': 'k3'}
>>>
it wasn't producing the correct output
ReplyDeleteIt is producing desire output. So, Please check it in your IDLE Python.
DeleteIntentionally clicking ads😄
ReplyDeleteGreat content thank you!
Welcome 😊😊😊😊😄🤗🤗🤗
Deletedidnt understand the 4th line
ReplyDeletePlease watch the video for proper explanation.
Deletethank you
ReplyDeleteWelcome : )
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )