MCPcopy
hub / github.com/trekhleb/learn-python / fibonacci_at_position

Function fibonacci_at_position

src/modules/fibonacci_module.py:11–18  ·  view source on GitHub ↗

Return Fibonacci number at specified position

(position)

Source from the content-addressed store, hash-verified

9
10
11def 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
21def fibonacci_smaller_than(limit):

Callers 1

test_modulesFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_modulesFunction · 0.72