Urara-Blog/node_modules/.pnpm-store/v3/files/5d/5e6401373ec9df0d6e1cc7bff6b65bc77a75e600d318ee538f7c39ec50e1d228b4e3d3a72b7be5b3d6ebb8bf69486a06787e1b98c98b5cc9e8c5ce29d4382f
2022-08-14 01:14:53 +08:00

12 lines
No EOL
315 B
Text

def fib(n): # write Fibonacci series up to n
"""Print a Fibonacci series up to n."""
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
print()
# Now call the function we just defined:
fib(2000)
# From https://docs.python.org/3/tutorial/controlflow.html#defining-functions