擅长:python、mysql、java
<p>你的第二个问题</p>
<p><code>but it is not out the range of the list. What is the problem?</code></p>
<p>这只是超出范围的错误。你知道吗</p>
<pre><code>l1[-len(l1)-1]
</code></pre>
<p>引发此错误。您正在代码中执行此操作。你知道吗</p>
<pre><code>for k in range(len(l1)):
...
elif(int(l1[-k]) - int(l1[-k-1])== 1 and int(l1[-k]) - int(l1[-k-2])== 2) :#<--here(l1[-k-2])
</code></pre>