Skip to content

Commit d1a45cd

Browse files
authored
Update Binary_Search.py
1 parent 7009060 commit d1a45cd

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Searching/Binary_Search.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ def binary_search(arr,target,low,high):
1010
else:
1111
return -1
1212

13-
14-
arr=[1,7,13,15,20,50]
15-
target=15
16-
result=binary_search(sorted(arr),target,0,len(arr)-1)
17-
if result!=-1:
18-
print(f"Found element at index {result}")
19-
else:
20-
print("Not found")
13+
if __name__=="__main__":
14+
arr=[1,7,13,15,20,50]
15+
target=15
16+
result=binary_search(sorted(arr),target,0,len(arr)-1)
17+
if result!=-1:
18+
print(f"Found element at index {result}")
19+
else:
20+
print("Not found")

0 commit comments

Comments
 (0)