I have written a program that should print out all the composite numbers from 0 to 100, but I keep getting the error "list index out of range"
What could I do to fix it?
def isPrime(x):
if x==0:
return False
if x==1 or x==2:
return True
for i in range(2, x):
if x%i==0:
return False
break
elif x%i==1:
return True
else:
print("error")
i=0
num = list(range(100))
while i<100:
if isPrime(num[i]==True): #I get the error here
del (num[i])
i += 1
else:
i += 1
print(num)