Here is some code I have been working on for an assignment, basically it finds prime numbers in between two variables-in any case, I have been trouble figuring out a way to restart the program based on user input. Basically the user inputs y to restart and n to quit. Unfortunately, the code I have been coming up with so far is not working-thoughts?
from math import *
def isPrime(n):
if n%2==0 and n!=2:return False
k = n**0.5 ; m = ceil(k)
if k==m:return False
for i in xrange(3,int(m),2):
if n%i==0:return False
return True
if __name__=='__main__':
s = input('Enter Start: ')
e = input('Enter End: ')
s|=1 #if s%2==0:s+=1
list = [x for x in range(s,e,2) if isPrime(x)]
print "list of prime numbers", list
print "type y/n to go again or not"
cont_flag = True
while cont_flag:
isPrime(x)
dummy = raw_input('again (y/n): ').lower()
if dummy != 'y':
cont_flag = False