From e28207776e9e545f8dcba153693dd8d305aecf25 Mon Sep 17 00:00:00 2001 From: nikhil purswani <31539117+nickcodhackder@users.noreply.github.com> Date: Thu, 4 Oct 2018 15:35:24 +0530 Subject: [PATCH] Create fibo.py --- Mathematics/fibonacci/python/fibo.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Mathematics/fibonacci/python/fibo.py diff --git a/Mathematics/fibonacci/python/fibo.py b/Mathematics/fibonacci/python/fibo.py new file mode 100644 index 000000000..bf9f4d28b --- /dev/null +++ b/Mathematics/fibonacci/python/fibo.py @@ -0,0 +1,13 @@ +def recur_fibo(n): + if n <= 1: + return n + else: + return(recur_fibo(n-1) + recur_fibo(n-2)) +nterms = int(input("How many terms? ")) + +if nterms <= 0: + print("Plese enter a positive integer") +else: + print("Fibonacci sequence:") + for i in range(nterms): + print(recur_fibo(i))