class Solution:
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
n = len(nums)
start = 0
end = n-1
while start<=end:
mid = (start+end)/2
if nums[mid] == target:
return mid
elif nums[mid] < target:
start=mid+1
continue
elif nums[mid] > target:
end=mid-1
continue
return -1
题解中没有continue