解釋器的結果和這種示例運行結果不一樣 能告訴我是什么原因嗎?
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]