fibonacci yo

This commit is contained in:
Armen Vartan
2014-12-02 15:09:39 -05:00
parent 45d3de2efe
commit a8b7f2ddef
2 changed files with 11 additions and 10 deletions

View File

@ -1,14 +1,15 @@
##The Fibonacci Sequence The Fibonacci Sequence
======================
The fibonacci sequence are the numbers in the following integer 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 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. 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. 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 Numbers](http://en.wikipedia.org/wiki/Fibonacci_number)
[Fibonacci in Nature](http://jwilson.coe.uga.edu/emat6680/parveen/fib_nature.htm) [Fibonacci in Nature](http://jwilson.coe.uga.edu/emat6680/parveen/fib_nature.htm)

View File

@ -3,7 +3,7 @@ def fibonacci(num):
# FOR TESTING ONLY # TESTS
import random import random
def random_fibonacci(): 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] 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]