2024-09-29 01:20:07 发布
网友
如何找到myList[-1]的正索引? 这是我想要的一个例子:
myList[-1]
输入:
myList = [1, 2, 3, 4, 3] # Please keep in mind that the list can have multiple values that are the same myIndex = # Find out the positive index of myList[-1] and store in myIndex variable print(myIndex)
期望输出:
4
那么是,
myList = [1, 2, 3, 4, 3] index = len(myList) - 1
您可能需要检查它是否大于或等于零
那么是,
您可能需要检查它是否大于或等于零
相关问题 更多 >
编程相关推荐