Learn practical skills, build real-world projects, and advance your career
!pip install jovian --upgrade --quiet
jovian.commit()
[jovian] Attempting to save notebook..

To find a elemrnt in the array

  • Using Linear Search Algorithm
x = input()
l = [45, 69, 5, 36, 21, 1, 47, 87]
# l=[int(y) for y in input().split()]
# print(l)
def linearSearch(l,x):
    position=0
    while True:
        if l[position] = x:
            return position
        else:
            position = position + 1
        
    
5 45 69 5 36 21 1 47 87 [45, 69, 5, 36, 21, 1, 47, 87]