Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Why doesn't the loop work?
Why doesn't the loop in the following code work?
out what numbers are prime.
primes = [2,3,5,7,11,13,17,19,23]
finish = int(raw_input("What number would you like to check to? "))
start = 24
while start >= finish:
x = 0
while start % primes[x] != 0:
x = x + 1
start = start + 1
When run, it just prints out the default set of primes after taking the number you want the program to check up to.
Swat spam before it fills your inbox!
0 · ·