I know printing primes isn't anything new, but (like always) I'd love to hear some feedback on how I can make my code more efficient and other constructive criticism.
def print_primes(r=10): primes = [ ] for i in range(2,r+1): prime = 1 for divisor in range(2,i): if i % divisor == 0: prime = 0 break if prime: primes.append(i) print "primes between 1 and %d:" % (r) for prime in primes: print prime, print_primes()
EDIT: BAH! I CAN'T DELETE THIS! I just realized there's another prime thread and it has more advanced versions of this program. Sorry for the nuisance!