From e7e7a9a58f400b2493d99e58f18c18465c0ac2b6 Mon Sep 17 00:00:00 2001 From: Suresh-vivek Date: Sat, 25 Sep 2021 23:38:06 +0530 Subject: [PATCH] Add linear-search.py --- searching/linear-search.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 searching/linear-search.py diff --git a/searching/linear-search.py b/searching/linear-search.py new file mode 100644 index 0000000..3252e3a --- /dev/null +++ b/searching/linear-search.py @@ -0,0 +1,31 @@ +print("Enter the number of elements in list") +num_list=int(input()) +list=[] + +for i in range(1,(num_list+1)): + if i==1: + place="st" + elif i==2: + place="nd" + elif i==3: + place="rd" + else: + place="th" + print("Enter the ", i, place ," number" ) + num=int(input()) + list.append(num) + +mylist= list + +print("Enter the number to search in the list") +ele=int(input()) + +flag=False + +for i in mylist: + if i==ele: + flag=True + + +if flag==True: + print("Element Found") \ No newline at end of file