You are viewing a single comment's thread. Return to all comments →
Python 3
def prime_check(n): if n < 2: return False for i in range(2, int((n**(1/2))+1)): if n % i == 0: return False return True t = int(input()) for ti in range(t): prime_result = prime_check(int(input())) if prime_result: print("Prime") else: print("Not prime")
Seems like cookies are disabled on this browser, please enable them to open this website
Day 25: Running Time and Complexity
You are viewing a single comment's thread. Return to all comments →
Python 3