Commit 8d891603 authored by Manasani suraj's avatar Manasani suraj

linear search

parent 4f0deaac
list = [4, 2, 8, 9, 3, 7]
x = int(input("Enter number to search: ")
for i in range(len(list)):
if(list[i] == x):
found = True
print("%d found at %dth position"%(x,i))
break
if(found == False):
print("%d is not in list"%x)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment