From 4611f7cec68549bd17b9e74552ee653267b21fec Mon Sep 17 00:00:00 2001 From: Yuvraj Tomar Date: Fri, 29 Mar 2024 15:21:57 +0530 Subject: [PATCH 1/2] add new file for addition and linear search --- search/add.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 search/add.py diff --git a/search/add.py b/search/add.py new file mode 100644 index 0000000..e67b4ae --- /dev/null +++ b/search/add.py @@ -0,0 +1,21 @@ +x=23 +y=87 +z=x+y +print(f"The addition of", x, "+", y, "is", z) + +print() + +l=[0,1,2,3,34,2267,12] +e=3 + +f= False +for i in l: + if(i==l): + f=True + break +if(f==True): + print("Element found at position") + +else: + print("Element not found") + From f97044b1cb0466750e6399d1e4a6011ecc694f03 Mon Sep 17 00:00:00 2001 From: Yuvraj Tomar Date: Fri, 29 Mar 2024 16:08:14 +0530 Subject: [PATCH 2/2] add linar search for input the no. --- search/add.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/search/add.py b/search/add.py index e67b4ae..4625067 100644 --- a/search/add.py +++ b/search/add.py @@ -6,7 +6,7 @@ print() l=[0,1,2,3,34,2267,12] -e=3 +e=int(input("Enter element to be searched")) f= False for i in l: @@ -17,5 +17,5 @@ print("Element found at position") else: - print("Element not found") + print("Element not found")