From a8b7f2ddef1143bc72d95222e6de4f457db4ac7e Mon Sep 17 00:00:00 2001 From: Armen Vartan Date: Tue, 2 Dec 2014 15:09:39 -0500 Subject: [PATCH] fibonacci yo --- python/9b-is-fibonacci/README.md | 17 +++++++++-------- python/9b-is-fibonacci/fibonacci.py | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/python/9b-is-fibonacci/README.md b/python/9b-is-fibonacci/README.md index c664eb6..b90a2eb 100644 --- a/python/9b-is-fibonacci/README.md +++ b/python/9b-is-fibonacci/README.md @@ -1,14 +1,15 @@ -##The Fibonacci Sequence - -The fibonacci sequence are the numbers in the following integer sequence: - - 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...and so on +The Fibonacci Sequence +====================== +The fibonacci sequence are the numbers in the following integer sequence: +``` +0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...and so on +``` Write a function that detects whether its input is a fibonacci number or not. Make sure the assert statements all pass. Write two of your own Python assert statements. -Resources -========= +## Resources + [Fibonacci Numbers](http://en.wikipedia.org/wiki/Fibonacci_number) -[Fibonacci in Nature](http://jwilson.coe.uga.edu/emat6680/parveen/fib_nature.htm) \ No newline at end of file +[Fibonacci in Nature](http://jwilson.coe.uga.edu/emat6680/parveen/fib_nature.htm) diff --git a/python/9b-is-fibonacci/fibonacci.py b/python/9b-is-fibonacci/fibonacci.py index 818b9c1..642c3c5 100644 --- a/python/9b-is-fibonacci/fibonacci.py +++ b/python/9b-is-fibonacci/fibonacci.py @@ -3,7 +3,7 @@ def fibonacci(num): -# FOR TESTING ONLY +# TESTS import random def random_fibonacci(): fib = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025] @@ -13,4 +13,4 @@ assert(fibonacci(random_fibonacci()) == True), "Random Fibonacci number should r assert(fibonacci(50) == False), "50 should return false" assert(fibonacci(97450) == False), "50 should return false" assert(fibonacci(1) == True), "1 should return true" -assert(fibonacci(7540113804746346429) == True), "A massive number in sequence should return true" \ No newline at end of file +assert(fibonacci(7540113804746346429) == True), "A massive number in sequence should return true"