Skip to content

Commit 0610038

Browse files
committed
style: fix indentation and pass all pre-commit checks
1 parent dcc3fed commit 0610038

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

maths/fibonacci.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ def fib_recursive_term(i: int) -> int:
122122
raise ValueError("n is negative")
123123
return [fib_recursive_term(i) for i in range(n + 1)]
124124

125-
def fib_recursive_cached(n: int) -> list[int]:
125+
def fib_recursive_cached(n: int) -> list[int]:
126126
"""
127-
Calculates the first n (0-indexed) Fibonacci numbers using recursion
127+
Calculates the first n (0-indexed) Fibonacci numbers using recursion.
128+
128129
>>> fib_iterative(0)
129130
[0]
130131
>>> fib_iterative(1)
@@ -142,7 +143,7 @@ def fib_recursive_cached(n: int) -> list[int]:
142143
@functools.cache
143144
def fib_recursive_term(i: int) -> int:
144145
"""
145-
Calculates the i-th (0-indexed) Fibonacci number using recursion
146+
Calculates the i-th (0-indexed) Fibonacci number using recursion.
146147
"""
147148
if i < 0:
148149
raise ValueError("n is negative")
@@ -154,7 +155,6 @@ def fib_recursive_term(i: int) -> int:
154155
raise ValueError("n is negative")
155156
return [fib_recursive_term(i) for i in range(n + 1)]
156157

157-
158158
def fib_memoization(n: int) -> list[int]:
159159
"""
160160
Calculates the first n (0-indexed) Fibonacci numbers using memoization
@@ -320,3 +320,4 @@ def fib_matrix_np(n: int) -> int:
320320
time_func(fib_recursive_cached, num) # 0.0153 ms
321321
time_func(fib_recursive, num) # 257.0910 ms
322322
time_func(fib_matrix_np, num) # 0.0000 ms
323+

0 commit comments

Comments
 (0)