Q:

change tuple in list output python

I got a dictionary like below: 
a = [('Ma', [128.35226732698018]), ('Ta', [56.42857142857143]), ('Eg', [46.35428571428572]), ('Ky', [41.6177429876057])]

the thing I'd like to output is like that:
Ma (128.35)
Ta (56.43)
Eg (46.35)
Ky (41.62)

How could I get rid of both list and tuple and change the number into float:2f?

A:

a = [('Ma', [128.35226732698018]), ('Ta', [56.42857142857143]), ('Eg', [46.35428571428572]), ('Ky', [41.6177429876057])]

for k in a:

    print(k[0], '{:.2f}'.format(k[1][0]))

A:

The following uses value unpacking and string formating, both very important to learn about:
a = [('Ma', [128.35226732698018]), ('Ta', [56.42857142857143]), ('Eg', [46.35428571428572]), ('Ky', [41.6177429876057])]

for k, v in a:
    print('{} ({:.2f})'.format(k, *v))

Outputs:
Ma (128.35)
Ta (56.43)
Eg (46.35)
Ky (41.62)

As @Ajax1234 states, the unpacking performed by the * operator only workds with Python 3. If you are using Python 2 you can replace *v with v[0]. Note that the latter works with both.

