SIMULATION FOR LINEAR SEARCH USING PYTHON

Demo: Linear Search

2
4
6
8
10
12
14
16

Simulator

  (Select Check Box for Step by Step Functioning)



Execution

plist = []
number = int(input("Num of Elements in Array "))
for i in range(0,number):
  emt=int(input())
  plist.append(emt)
searchItem=int(input('Element you want to search: '))
found = False
for i in range(len(plist)):
  if plist[i] == searchItem:
    found = True
    print('Great..Element found at position',i+1)
    break
if found == False:
  print("Element not found")