From 1668523b1a446e16ce9084f73457a0db83c6b6b7 Mon Sep 17 00:00:00 2001 From: Kyle Fauerbach Date: Thu, 25 Oct 2018 13:55:41 -0400 Subject: [PATCH] Create fibonacci.py --- fibonacci.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 fibonacci.py diff --git a/fibonacci.py b/fibonacci.py new file mode 100644 index 0000000..1ea3118 --- /dev/null +++ b/fibonacci.py @@ -0,0 +1,9 @@ +num = int(input("How many fibonacci numbers?") + +def fib(n): + a, b = 0, 1 + for _ in range(n): + yield a + a, b = b, a + b + +print(list(fib(num)))