There is something strange here below. If I were to change y.append(temp[-1]) to y.append(temp[1]). I would get an error message
y.append(temp[1]) IndexError: list index out of range
since I am indexing variable a, I should get the following temp value each time in the loop.
['350', '2']
['450', '9']
['570', '12']
['', '']
This should allow me to use temp[0] and temp[1]. Is this a bug?
x = []
y = []
a = ['350 5', '450 9', '570 12', '']
for index in range(len(a)):
print(index)
temp = a[index].split(" ")
x.append(temp[0])
y.append(temp[-1])
print(x)
print(y)