Skip to content

Commit 797be12

Browse files
committed
Replace generic exception with ValueError in linear search
1 parent 791deb4 commit 797be12

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

searches/linear_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def rec_linear_search(sequence: list, low: int, high: int, target: int) -> int:
5555
-1
5656
"""
5757
if not (0 <= high < len(sequence) and 0 <= low < len(sequence)):
58-
raise Exception("Invalid upper or lower bound!")
58+
raise ValueError("Invalid upper or lower bound!")
5959
if high < low:
6060
return -1
6161
if sequence[low] == target:

0 commit comments

Comments
 (0)