擅长:python、mysql、java
<pre><code>for i in range(1, len(lst)-1):
...
</code></pre>
<p>这段代码首先创建一个包含数字<code>[1,2,3,...,len(lst)-1]</code>的列表,然后通过在每次迭代中将<code>i</code>设置为列表中的值来循环这些值。你知道吗</p>
<pre><code>for i in range (integerList[0], len(integerList))
</code></pre>
<p>这段代码实际上创建了一个包含以下数字的列表:</p>
<p><code>[integerList[0],integerList[0] + 1,integerList[0] + 2,...,len(integerList)]</code></p>
<p>这里的范围是从<code>integerList[0]</code>开始的,不是索引。如果<code>integerList[0]</code>大于<code>len(integerList)</code>,则得到一个没有值的数组<code>[]</code></p>
<p>然后在第二个函数中尝试使用<code>lst</code>,而实际上是在寻找<code>integerList</code></p>