0

If I write this code:

lst = [one, two, three] = [i for i in range(1,4)]

I can access the first elemnt of the list by lst[0] and by one at will.

How can I assign the values in the later for loop with the same result? A for loop I am referring to, e.g.:

for count, i in enumerate(range(1,4)):
    lst[count] = i

Of course, I can't start even from that:

lst = [one, two, three]

I am stuck and don't know how to properly do this.

I can do a workaround using dictionary but that's not what I want.

Andrew Anderson
  • 1,044
  • 3
  • 17
  • 26

0 Answers0