标签:arc index strong span search str pytho return arch
python实现二分法查找
nums = [1,2,5,6,8,9,11,22,44,55,67,90] def search(search_num,nums): if len(nums) == 0: print(‘not find‘) return index_nums = len(nums)//2 if search_num > nums[index_nums]: nums = nums[index_nums+1:] search(search_num,nums) elif search_num < nums[index_nums]: nums = nums[:index_nums] search(search_num,nums) else: print(‘find it‘) search(3,nums)
标签:arc index strong span search str pytho return arch
原文地址:https://www.cnblogs.com/neymargoal/p/9912412.html