mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
[3.14] feat(docs): type fix - apply pep8 by using docstring instead of comment in the doc. (GH-135181) (#135212)
feat(docs): type fix - apply pep8 by using docstring instead of comment in the doc. (GH-135181)
Giving the right example incitates the tutorial readers to do the same in the future.
(cherry picked from commit 343182853f
)
Co-authored-by: Jean-Louis GUENEGO <jlguenego@gmail.com>
This commit is contained in:
parent
5b38af57e0
commit
23552b3d8f
1 changed files with 4 additions and 2 deletions
|
@ -27,14 +27,16 @@ called :file:`fibo.py` in the current directory with the following contents::
|
|||
|
||||
# Fibonacci numbers module
|
||||
|
||||
def fib(n): # write Fibonacci series up to n
|
||||
def fib(n):
|
||||
"""Write Fibonacci series up to n."""
|
||||
a, b = 0, 1
|
||||
while a < n:
|
||||
print(a, end=' ')
|
||||
a, b = b, a+b
|
||||
print()
|
||||
|
||||
def fib2(n): # return Fibonacci series up to n
|
||||
def fib2(n):
|
||||
"""Return Fibonacci series up to n."""
|
||||
result = []
|
||||
a, b = 0, 1
|
||||
while a < n:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue