diff options
author | gabrieldemarmiesse <gabriel.demarmiesse@teraki.com> | 2018-05-26 14:41:16 +0200 |
---|---|---|
committer | gabrieldemarmiesse <gabriel.demarmiesse@teraki.com> | 2018-05-27 14:14:29 +0200 |
commit | f35173fba8614b83d26ce11c9a34af5fc3b3bc71 (patch) | |
tree | 7de1a76a7bcd7eed5aed8ccfc00c8bf39d2e6c4d /docs/examples/tutorial/cython_tutorial/fib.pyx | |
parent | 45df48301b0ab5dd35e9d68581b57f15b69dd74f (diff) | |
download | cython-f35173fba8614b83d26ce11c9a34af5fc3b3bc71.tar.gz |
Now all the files in the example directory are tested.
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() |