Skip to content

Commit 2796b65

Browse files
committed
Exception resolve issue #475
1 parent 9d48190 commit 2796b65

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pydatastructs/multi_threaded_algorithms/fibonacci.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class Fibonacci:
1212
"""
1313

1414
def __init__(self, n, backend='python'):
15+
if n<0:
16+
raise ValueError("n cannot be negative")
1517
self.n = n
1618
self.backend = backend
1719
self.result = [None] * (n + 1) # To store Fibonacci numbers

0 commit comments

Comments
 (0)