I am trying to get the sieve of Eratosthenes here but the code keeps returning the original list. I have no idea what is wrong. Please do help a poor novice- and thank you very much in advance!!
def main():
cupcake = []
i = 0
for i in range(1, 101):
cupcake += [i]
cupcake.remove(1)
cupcake.insert(0, 0)
for j in range(len(cupcake)):
if cupcake[j] > 0:
for k in range(len(cupcake)):
if cupcake[k] > 0:
product = int(cupcake[k]) / int(cupcake[j])
if (type(product) is int) == True:
if product == 1:
continue
cupcake.remove(cupcake[k])
cupcake.insert((k-1), 0)
print(cupcake)