Skip to content

Commit 9ea9f2c

Browse files
Replace generic exception with ValueError in linear search (#14641)
Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent a4c1df1 commit 9ea9f2c

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)