You are viewing a single comment's thread. Return to all comments →
def is_prime(num): if num <= 1: return False else: if num == 2: return True factor = 2 if num % factor == 0: return False factor = 3 while factor * factor <= num: if num % factor == 0: return False factor += 2 return True def print_is_prime(num): print("Prime" if is_prime(num) else "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 →