Ex.No. #5(a) LINEAR SEARCH (English)
Ex. No. : 5(a) Linear
Search
Aim:
To write a Python Program to perform Linear
Search
Program:
items=[24,6,32,5,70]
print("The
list of Numbers",items)
x=int(input("Enter
the items to be searches :"))
i=flag=0
while
i<len(items):
if items[i]==x:
flag=1
break
i=i+1
if
flag==1:
print("item is found :",i+1)
else:
print("item is not found")
Comments
Post a Comment