filmov
tv
Swap Key and Value in Python Dictionary

Показать описание
In this video, you will learn how to populate a Python dictionary with swapped key-value from a given dictionary.
Suppose the dictionary is: {2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}
then the output should be: {4: 2, 9: 3, 16: 4, 25: 5, 36: 6, 49: 7, 64: 8}
Suppose the dictionary is: {2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}
then the output should be: {4: 2, 9: 3, 16: 4, 25: 5, 36: 6, 49: 7, 64: 8}