def is_prime(x): if x < 2: return False elif x == 2: return True else: count = 0 for n in range (2,x): if float(x) % float(n) == 0: count += 1 if count == 0: return True else: return False print is_prime(999999) what does float mean?
float() will cast integers to floats, you can always add print statements to see what something is doing:
for n in range (2,x): print x, float(x), n, float(n)
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.