Skip to content

Commit 631037d

Browse files
Update dynamic_programming/fibonacci.py
Co-authored-by: Bertrand Awenze <156874668+bertrand-awz@users.noreply.github.com>
1 parent 6cc951a commit 631037d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

dynamic_programming/fibonacci.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ def get_nth(self, n: int) -> int:
140140
ValueError: Index must be non-negative, got -1
141141
"""
142142
if n < 0:
143-
raise ValueError(f"Index must be non-negative, got {n}")
143+
error_msg = f"Index must be non-negative, got {n}"
144+
raise ValueError(error_msg)
144145

145146
# Extend sequence if needed
146147
if n >= len(self.sequence):

0 commit comments

Comments
 (0)