Skip to content

Add doctests to primelib.py #10242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update primelib.py
  • Loading branch information
cornbread-eater authored Oct 10, 2023
commit 4515cb97a11d2b3b5c002aa74390c4dffd08ef8a
9 changes: 9 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,7 @@ def fib(n):
fib1 = tmp

return ans

if __name__ == "__main__":
import doctest
doctest.testmod()