[英]How is -1,-1,-1 in python reverse list code working? I would like to know the principle
I'm a python beginner and I am learning to reverse a list without using [::-1] and the reversed function.我是 python 初学者,我正在学习不使用 [::-1] 和反转函数来反转列表。 I read this explanation below but wasn't sure how the principle works.我在下面阅读了这个解释,但不确定该原理是如何工作的。 Are -1,-1,-1 in range(len(list)-1, -1, -1) working like the start, stop, step in index? range(len(list)-1, -1, -1) 中的 -1,-1,-1 是否像索引中的开始、停止、步骤一样工作? If it is, why is the second number -1 as well?如果是,为什么第二个数字也是-1? I'm posting this as I know no one to ask about coding.我发布这个是因为我知道没有人问编码。
https://stackoverflow.com/a/530507/17098889 https://stackoverflow.com/a/530507/17098889
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.