programming-examples/python/Tuple/Python program to convert a tuple to a dictionary.py

3 lines
85 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
#create a tuple
tuplex = ((2, "w"),(3, "r"))
print(dict((y, x) for x, y in tuplex))