出力がリストであるプログラムを作成しました。問題は、リストを昇順で取得するプログラムを作成できないことです。そのため、リストを任意の長さで昇順でソートする方法を見つけたいと思います。あなたは私を助けることができます?これらは私のコードです:
import math
n=int(input())
notPrimes=[]
primes=[]
numbers=list(range(0,n))
numbers.remove(1)
numbers.remove(0)
for i in range(2,int(math.sqrt(n)+1)):
for j in numbers:
if j%i==0:
notPrimes.append(j)
if j in numbers:
numbers.remove(j)
#notPrimes is the list I have to sort
これらは私のコードで、そのリストを昇順で並べる必要があります。