Update primelib.py

This commit is contained in:
rtang09 2023-10-09 23:32:33 -07:00 committed by GitHub
parent 6d13603667
commit 9fe40f3aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()