请注意 - 这篇文章被用作课堂示例,请不要因为提出如此明显的问题而投反对票
我试图从这个数组中提取第四个值。下面你可以看到我尝试过的几种方法。任何人都可以建议一种可以实现这一目标的方法吗?
# creating the array
array = [1, 4, 5, 6, 7, 8, 9]
# attempted using an index value, which returned 7 instead 6
array[4]
7
# attempted using pop method, which returned the array [6, 7, 8, 9]
array.pop(4)
[6, 7, 8, 9]