mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Update primelib.py
This commit is contained in:
parent
6d13603667
commit
9fe40f3aa7
@ -46,6 +46,15 @@ def is_prime(number: int) -> bool:
|
||||
"""
|
||||
input: positive integer 'number'
|
||||
returns true if 'number' is prime otherwise false.
|
||||
|
||||
>>> is_prime(97)
|
||||
True
|
||||
>>> is_prime(9991)
|
||||
False
|
||||
>>> is_prime(-3)
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
AssertionError: 'number' must been an int and positive
|
||||
"""
|
||||
|
||||
# precondition
|
||||
@ -589,3 +598,7 @@ def fib(n):
|
||||
fib1 = tmp
|
||||
|
||||
return ans
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
doctest.testmod()
|
||||
|
Loading…
Reference in New Issue
Block a user