From 87ff559195924278179408f4952b99545cad7cca Mon Sep 17 00:00:00 2001 From: Sudhanshu Mishra Date: Fri, 5 Oct 2018 09:06:36 +0530 Subject: [PATCH] Add files via upload --- linear_search/Python/linearsearch.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 linear_search/Python/linearsearch.py 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****************") +