Ad
Code
Diff
  • from math import sqrt
    def prime(x):
        if x <= 1:
            return False
        for i in range(2,int(sqrt(x))):
            if x % i is 0:
                return False
        return True
    • from math import sqrt
    • def prime(x):
    • if x <= 1:
    • return False
    • for i in range(2,int(x/2)):
    • for i in range(2,int(sqrt(x))):
    • if x % i is 0:
    • return False
    • return True