mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-07 10:00:55 +00:00
Add doctests to primelib.py (#10242)
* Update primelib.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
0070739233
commit
c850227bee
|
@ -574,6 +574,11 @@ def fib(n):
|
||||||
"""
|
"""
|
||||||
input: positive integer 'n'
|
input: positive integer 'n'
|
||||||
returns the n-th fibonacci term , indexing by 0
|
returns the n-th fibonacci term , indexing by 0
|
||||||
|
|
||||||
|
>>> fib(5)
|
||||||
|
8
|
||||||
|
>>> fib(99)
|
||||||
|
354224848179261915075
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# precondition
|
# precondition
|
||||||
|
@ -589,3 +594,9 @@ def fib(n):
|
||||||
fib1 = tmp
|
fib1 = tmp
|
||||||
|
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import doctest
|
||||||
|
|
||||||
|
doctest.testmod()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user