1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-09 19:19:07 +01:00
CodeWars/6kyu/is_a_number_prime/solution.py

17 lines
283 B
Python
Raw Normal View History

import math
def is_prime(num):
if num <= 1:
return False
elif num == 2:
return True
elif num % 2 == 0:
return False
bound = int(math.ceil(math.sqrt(num)))
for div in range(3, bound + 1, 2):
if num % div == 0:
return False
return True