Determine the Fibonacci number at any valid index value. More...
Functions | |
| def | Fibonacci.fib (idx) |
| This function calculates a Fibonacci number at a specific index. More... | |
Variables | |
| Fibonacci.idx = input('Please enter a Fibonacci index value ') | |
Users must enter a Fibonacci index value, stored as idx More... | |
Determine the Fibonacci number at any valid index value.
This lab is intended to serve as an introduction to Python. See code here: https://bitbucket.org/ryanmclaug/me_305/src/master/Lab0x01/Fibonacci.py
| def Fibonacci.fib | ( | idx | ) |
This function calculates a Fibonacci number at a specific index.
Using a while loop and a bottom up approach solution method, this function determines the Fibonacci number for a given index. Note that this function is only designed to handle valid index values, such that any invalid indecies should be handled by the test program.
| idx | A postivie integer specifying the index of the desired Fibonacci number |
| Fibonacci.idx = input('Please enter a Fibonacci index value ') |
Users must enter a Fibonacci index value, stored as idx
Each time the user is prompted for input, the index value input defines which Fibonacci number will be calculated.