demo = []
for i in range(1,11):
demo.insert(-1,i)
print(demo)
the result is [2, 3, 4, 5, 6, 7, 8, 9, 10, 1]
demo = []
for i in range(1,11):
demo.insert(0,i)
print(demo)
the result is [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
The former code block is used to realize something like append(). Obviously, something went wrong. However, when I changed the index from -1 to 0, just as the latter code block, it seems all right. I'm confused about that.