prorgamming newbie--I was looking for answers to an exercise I was doing and got my answers from here. My question is this--from that thread, the one chosen as best answer, was this code
[float(i) for i in lst]
The code did what it was supposed to do, but when I tried to get to that new list, I am getting errors
>>> xs = '12 10 32 3 66 17 42 99 20'.split()
>>> [float(i) for i in xs]
[12.0, 10.0, 32.0, 3.0, 66.0, 17.0, 42.0, 99.0, 20.0]
>>> i
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'i' is not defined
How should I do it?
Thanks!