Loading...
「ツール」は右上に移動しました。
利用したサーバー: wtserver1
0いいね 10 views回再生

How to replace keys and values in a dictionary [Q-VIVA VOCE] EASY PYTHON

def dvdict(dictionary):
keys = list(dictionary.keys())
values = list(dictionary.values())
return dict(zip(values,keys))
dict1 = {1:11,2:22,3:33}
print(dict1,end="\n\n\n")
newDict = dvdict(dict1)
print(newDict)

How to replace keys and values in dictionary
how to change keys to values in dictionary
EASY PYTHON


#easypython
#valuestokeys
#pythonprogramming
#easy

コメント