On Feb 26, 10:04 am, Rupesh Pradhan <[email protected]> wrote: > Method I > -------- > c = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')] > key=3 > > >>> for i, j in c: > > ... if i==key: print j > > UKG > > Method II > --------- > c = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')] > r = dict((x[0],x[1]) for x in c)
r = dict(c) is enough > > print r[3] > > UKG > > Method III > ---------- > Anything better than the above two?

