Return Fibonacci number at specified position
(position)
| 9 | |
| 10 | |
| 11 | def fibonacci_at_position(position): |
| 12 | """Return Fibonacci number at specified position""" |
| 13 | current_position = 0 |
| 14 | previous_number, current_number = 0, 1 |
| 15 | while current_position < position: |
| 16 | current_position += 1 |
| 17 | previous_number, current_number = current_number, previous_number + current_number |
| 18 | return previous_number |
| 19 | |
| 20 | |
| 21 | def fibonacci_smaller_than(limit): |