programming-examples/python/Tuple/Python program to convert a tuple to a dictionary.py
2019-11-15 12:59:38 +01:00

3 lines
85 B
Python

#create a tuple
tuplex = ((2, "w"),(3, "r"))
print(dict((y, x) for x, y in tuplex))