📌  相关文章
📜  python 使用 reverse() 函数的列表的最后一个元素 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:18.278000             🧑  作者: Mango

代码示例1
# Python code to access the last element
# in a list using reverse() method
  
# Declaring and  initializing list 
number_list = [2, 1, 7, 4, 5, 3,6]
  
print ("List of elements are : " + str(number_list))

# using reverse method to print last element
number_list.reverse()
print("The last element of list using reverse method are : "
                            +  str(number_list[0]))