feat(docs): type fix - apply pep8 by using docstring instead of comment in the doc. (#135181)
Giving the right example incitates the tutorial readers to do the same in the future.
This commit is contained in:
parent
39859fcac5
commit
343182853f
@ -27,14 +27,16 @@ called :file:`fibo.py` in the current directory with the following contents::
|
|||||||
|
|
||||||
# Fibonacci numbers module
|
# 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
|
a, b = 0, 1
|
||||||
while a < n:
|
while a < n:
|
||||||
print(a, end=' ')
|
print(a, end=' ')
|
||||||
a, b = b, a+b
|
a, b = b, a+b
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def fib2(n): # return Fibonacci series up to n
|
def fib2(n):
|
||||||
|
"""Return Fibonacci series up to n."""
|
||||||
result = []
|
result = []
|
||||||
a, b = 0, 1
|
a, b = 0, 1
|
||||||
while a < n:
|
while a < n:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user