I'm generating an index value associated with each tuple value :
a = ["what" , "a" , "test"]
c = 0
d = []
for b in a :
d.append((c , b))
c = c + 1
print(d)
generates :
[(0, 'what'), (1, 'a'), (2, 'test')]
Is there Python idiomatic / functional way to implement same functionality ?
Something like :
list(map(lambda x : (x , c+1) , a))