Jul-12-2018, 09:01 AM
(This post was last modified: Jul-12-2018, 09:03 AM by preethamalluri.)
Hi,
I have the following LIST in python, I am trying to convert it from this format to SEQUENCE OF TUPLES. I am able to convert it into a tuple but unable to get the desired output. Can someone please go through the code I have mentioned below ?
convert = ((4.0,), (4.0,), (4.0,), (4.0,), (4.0,), (4.0,), (4.0,))
Expected output = ((4.1,), (4.2,), (4.3,), (4.4,), (4.5,), (4.6,), (4.7,))
I am unable to see the decimal values of the output.
Thank you a lot for your time


List_to_be_converted = sf sf = ['4.1', '4.2', '4.3', '4.4', '4.5', '4.6', '4.7'] **sad** #code to convert # convert = tuple((float(x[0]), ) for x in sf)#output after running the code
convert = ((4.0,), (4.0,), (4.0,), (4.0,), (4.0,), (4.0,), (4.0,))
Expected output = ((4.1,), (4.2,), (4.3,), (4.4,), (4.5,), (4.6,), (4.7,))
I am unable to see the decimal values of the output.

Thank you a lot for your time