diff --git a/linear_search/Python/linearsearch.py b/linear_search/Python/linearsearch.py new file mode 100644 index 00000000..01d1025a --- /dev/null +++ b/linear_search/Python/linearsearch.py @@ -0,0 +1,16 @@ +print("************************Linear search*****************************") +arr=list() +n=input("Enter the number of elements : ") +for i in range(int(n)): + ele=int(input("Element : ")) + arr.append(int(ele)) +key=int(input("Enter the key(elemt to be searched): ")) +flag=0 +for i in range(int(n)): + if(arr[i]==key): + print("Element Found at ", i+1) + flag=1 +if flag==0: + print("Element not found ") +k=input("************************* Press Enter to Exit****************") +