mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Fix: Corrected test. List in test must be ordered. (#2632)
* Fix: Corrected test. List in test must be ordered. * Add tests with big lists.
This commit is contained in:
parent
c14cfa32df
commit
40db8c205f
|
@ -31,8 +31,14 @@ def binary_search(a_list: list[int], item: int) -> bool:
|
|||
False
|
||||
>>> print(binary_search([], 1))
|
||||
False
|
||||
>>> print(binary_search([.1, .4 , -.1], .1))
|
||||
>>> print(binary_search([-.1, .1 , .8], .1))
|
||||
True
|
||||
>>> binary_search(range(-5000, 5000, 10), 80)
|
||||
True
|
||||
>>> binary_search(range(-5000, 5000, 10), 1255)
|
||||
False
|
||||
>>> binary_search(range(0, 10000, 5), 2)
|
||||
False
|
||||
"""
|
||||
if len(a_list) == 0:
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue
Block a user