擅长:python、mysql、java
<p>首先,您可能会得到一个错误,因为range是一个整数,而不是生成器,请尝试使用<code>for i in n_list</code>或{<cd2>}。至于问题的解决方法,你不需要从2循环到n,有一个更聪明的方法。但我们在这里并不是要为你们解决这个问题,只是引导你们找到你们可能向我们展示的最终错误。就这样说,祝你好运!在</p>
<p>附言:
多一点指导
<a href="https://www.google.se/search?q=eratosthenes%20sieve&oq=eratosthenes%20sieve&aqs=chrome..69i57j0l5.12522j0j7&sourceid=chrome&ie=UTF-8#q=sieve%20of%20eratosthenes" rel="nofollow noreferrer">Sieve of Eratosthenes</a></p>
<p>编辑:
我指的错误是</p>
<pre><code>TypeError: 'list' object cannot be interpreted as an integer
</code></pre>