def is_prime(num):if num < 2:return Falsefor i in range(2, int(num ** 0.5) + 1):if num % i == 0:return Falsereturn True
print(is_prime(7)) # Trueprint(is_prime(10)) # False
def is_prime(num):
Пример использованияif num < 2:
return False
for i in range(2, int(num ** 0.5) + 1):
if num % i == 0:
return False
return True
print(is_prime(7)) # True
print(is_prime(10)) # False