I have written the following function which finds all divisors of a given natural number and returns them as a list:
def FindAllDivisors(x): divList = []
I'd suggest storing the result of math.sqrt(x) in a separate variable, then checking y against it. Otherwise it will be re-calculated at each step of while, and math.sqrt is definitely not a light-weight operation.
math.sqrt(x)
y
while
math.sqrt