Home>

Good day.

I have a list

y= [348, 336, 330, 340, 332, 333, 344, 348, 349, 344, 375, 349, 354, 348, 349, 354, 334, 349, 344, 348, 349, 334, 375, 349, 344, 334, 349, 334, 375, 334, 344, 334, 334, 354, 348, 349, 334, 375, 349, 344, 348, 349, 354, 334, 349, 344, 375, 349, 344, 334, 349, 334, 348, 349, 344, 334, 334, 334, 334, 334, 334, 348, 349, 334, 334, 334, 334

How to create another list, the length of which is equal to the length of the list and it will start from zero. I tried like this:

Y= [348, 336, 330, 340, 332, 333, 344, 348, 349, 354, 375, 379, 365, 356, 341, 312, 300, 294, 304, 323]
x= []
For i in Range (Len (X)):
    x [i]= y [i]
    X.APPEND (X)
Print (X)

He displays me an empty list

[]

and you need

x= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 11, 12, 9, 14, 11, 12, 13, 14, 11, 16, 17, 14, 11, 16, 17, 14, 11, 16, 17, 14, 11, 16, 17, 14, 11, 12, 12, 14, 11, 16, 17, 10, 11, 16, DO

X= List (Range (Len (Y)))

MaxU2021-04-09 07:54:40

You have two errors in the code. First -for i in Range (Len (X)): And it was necessary for I in Range (Len (Y)): So gives you a list of zero length)) the second -you see now))

Vasyl Kolomiets2021-04-09 07:54:40