We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b969226 commit d44b888Copy full SHA for d44b888
BinarySeach.py
@@ -9,17 +9,18 @@ def binarySearch(alist, item):
9
midpoint = (first + last)//2
10
if alist[midpoint] == item:
11
found = True
12
- print("Found")
+ print("Found [ at position: %s ]" % (alist.index(item) + 1))
13
else:
14
15
if item < alist[midpoint]:
16
17
last = midpoint-1
18
19
first = midpoint+1
20
+
21
if found == False:
-
22
- print("Not found")
+ continue
23
+ # print("Not found")
24
return found
25
print("Enter numbers seprated by space")
26
s = input()
0 commit comments