You are viewing a single comment's thread. Return to all comments →
Python solution:
def primality(n): if n < 2: return "Not prime" for i in range(2, int(math.sqrt(n)) + 1): if n % i == 0: return "Not prime" return "Prime"
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Time Complexity: Primality
You are viewing a single comment's thread. Return to all comments →
Python solution: