def linear_search(li, val):
for ind, v in enumerate(li):
if v == val:
return ind
else:
return None
顺序查找——python
于 2023-10-11 17:06:46 首次发布
def linear_search(li, val):
for ind, v in enumerate(li):
if v == val:
return ind
else:
return None