+ 1
linear search in python using list
def linear_search(num): for j in l: if l[i] == num: return i return -1 l=[] for i in range(int(input("Enter size"))): a = int(input("Enter no:")) l.append(a) b = int(input("Enter no to be searched")) linear_search(b) print(i) answer is coming 4 intead of 2 Help me out
1 Respuesta
+ 1
What are inputs you gave?