artir
January 25th, 2009, 10:03 PM
So I was writing my 1st prime finder sieve like this:
hasta=10
numeros=range(2,hasta+1)
lol=numeros
print numeros
for i in numeros:
for o in numeros:
quitar=o*i
if quitar in numeros:
lol.remove(quitar)
print lol
print numeros
Basically, the resulting primes should go to "lol", but the weird thing is that both "print lol" and "print numeros" return the same, even though I'm not doing anything to numeros but reading the i and o vars. What is that happening?
hasta=10
numeros=range(2,hasta+1)
lol=numeros
print numeros
for i in numeros:
for o in numeros:
quitar=o*i
if quitar in numeros:
lol.remove(quitar)
print lol
print numeros
Basically, the resulting primes should go to "lol", but the weird thing is that both "print lol" and "print numeros" return the same, even though I'm not doing anything to numeros but reading the i and o vars. What is that happening?