Search the Element in a list

flag=0
L=int(raw_input("Enter the length of list: "))
p=list()
for i in range(L):
      num=int(raw_input("Enter the elements : "))
      p.append(num)
j=int(raw_input("Enter the element to find: "))
     
for i in range(L):
      if (p[i]==j):
            flag=1
if flag==1:
      print "Element is found"
else:
        print "Element is not found"

No comments: