python convert list to dict with index

Solutions on MaxInterview for python convert list to dict with index by the best coders in the world

showing results for - "python convert list to dict with index"
Luca
08 Jul 2019
1>>> lst = ['A','B','C']
2>>> {k: v for v, k in enumerate(lst)}
3{'A': 0, 'C': 2, 'B': 1}
4