解释器的结果和这种示例运行结果不一样 能告诉我是什么原因吗?
digits = [2,3,8,9,0,3,5,7]
print("The first three items in the list are: ")
print(digits[:3])
print("\nThree items from the middle of the list are: ")
print(digits[2:5])
print("\nThe last three items in the list are: ")
print(digits[-3:])
运行结果如下:
The first three items in the list are:
[2, 3, 8]
Three items from the middle of the list are:
[8, 9, 0]
The last three items in the list are:
[3, 5, 7]