Let's say I have taken this line as input
n='3.4 5.9 4.76 1.0'
I want to split it into a list and convert each element to a float. Here's how I would do that
nlist = n.split()
for i in range(nlist):
nlist[i] = float(nlist[i])
This works fine but I was wondering, out of curiosity, if there was a way to save each element of the list as an actual number to avoid doing the second cycle and "manually" convert each element.