You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
300 B
20 lines
300 B
2 years ago
|
def is_prime(n: int) -> bool:
|
||
|
"""
|
||
|
>>> is_prime(10)
|
||
|
True
|
||
|
>>> is_prime(17)
|
||
|
True
|
||
|
>>> is_prime(21)
|
||
|
False
|
||
|
"""
|
||
|
for el in range(2, n):
|
||
|
if n % el == 0:
|
||
|
return False
|
||
|
return True
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
import doctest
|
||
|
|
||
|
doctest.testmod()
|