Skip to content

Commit 234f50b

Browse files
committed
Improve: handle empty sequence case in linear_search
1 parent 1c57978 commit 234f50b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

searches/linear_search.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
For manual testing run:
88
python3 linear_search.py
99
"""
10+
def linear_search(sequence: list, target: int) -> int:
11+
"""... existing docstring ..."""
12+
13+
if not sequence:
14+
return -1
1015

1116

1217
def linear_search(sequence: list, target: int) -> int:

0 commit comments

Comments
 (0)