Skip to content

Commit

Permalink
Add doctests to primelib.py (#10242)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
cornbread-eater and pre-commit-ci[bot] committed Oct 10, 2023
1 parent 0070739 commit c850227
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions maths/primelib.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,11 @@ def fib(n):
"""
input: positive integer 'n'
returns the n-th fibonacci term , indexing by 0
>>> fib(5)
8
>>> fib(99)
354224848179261915075
"""

# precondition
Expand All @@ -589,3 +594,9 @@ def fib(n):
fib1 = tmp

return ans


if __name__ == "__main__":
import doctest

doctest.testmod()

0 comments on commit c850227

Please sign in to comment.