diff options
Diffstat (limited to 'docs/examples/tutorial/cython_tutorial/fib.pyx')
-rw-r--r-- | docs/examples/tutorial/cython_tutorial/fib.pyx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/examples/tutorial/cython_tutorial/fib.pyx b/docs/examples/tutorial/cython_tutorial/fib.pyx new file mode 100644 index 000000000..473719cb3 --- /dev/null +++ b/docs/examples/tutorial/cython_tutorial/fib.pyx @@ -0,0 +1,10 @@ +from __future__ import print_function + +def fib(n): + """Print the Fibonacci series up to n.""" + a, b = 0, 1 + while b < n: + print(b, end=' ') + a, b = b, a + b + + print() |