[CODE lang="python" title="Insert() function confusion" highlight="3-4"]myList = [] # creating an empty list
for i in range(5):
myList.insert(0, i + 1)
print(myList)[/CODE]
I am new to Python and I am wondering why this outputs the numbers backwards. Surely it starts from 0 and not from the last value?
for i in range(5):
myList.insert(0, i + 1)
print(myList)[/CODE]
I am new to Python and I am wondering why this outputs the numbers backwards. Surely it starts from 0 and not from the last value?