From 47f888981435caae4b9f29b37acaa82b4639144c Mon Sep 17 00:00:00 2001 From: Ayush Goyal <73097046+NormalVad@users.noreply.github.com> Date: Sun, 25 Oct 2020 21:12:33 +0530 Subject: [PATCH 1/9] Python Linear Search program in python programming language --- day28/LinearSearch.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 day28/LinearSearch.py diff --git a/day28/LinearSearch.py b/day28/LinearSearch.py new file mode 100644 index 00000000..fc62bb6f --- /dev/null +++ b/day28/LinearSearch.py @@ -0,0 +1,20 @@ +def LinearSearch(a,n): + l = len(a) + found = False + i = 0 + while(i Date: Sun, 25 Oct 2020 21:18:17 +0530 Subject: [PATCH 2/9] Linear Search Python program for Linear Search Algorithm --- day28/Python/LinearSearch.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 day28/Python/LinearSearch.py diff --git a/day28/Python/LinearSearch.py b/day28/Python/LinearSearch.py new file mode 100644 index 00000000..bd2de62d --- /dev/null +++ b/day28/Python/LinearSearch.py @@ -0,0 +1,26 @@ +""" +@author:NormalVad +@date:25/10/2020 +""" + + +def LinearSearch(a,n): + l = len(a) + found = False + i = 0 + while(i Date: Sun, 25 Oct 2020 21:19:11 +0530 Subject: [PATCH 3/9] Delete LinearSearch.py --- day28/LinearSearch.py | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 day28/LinearSearch.py diff --git a/day28/LinearSearch.py b/day28/LinearSearch.py deleted file mode 100644 index fc62bb6f..00000000 --- a/day28/LinearSearch.py +++ /dev/null @@ -1,20 +0,0 @@ -def LinearSearch(a,n): - l = len(a) - found = False - i = 0 - while(i Date: Sun, 25 Oct 2020 21:25:06 +0530 Subject: [PATCH 4/9] Update README.md --- day28/README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/day28/README.md b/day28/README.md index 5d266d6b..c059aa0f 100644 --- a/day28/README.md +++ b/day28/README.md @@ -163,3 +163,36 @@ void main(){ } } ``` +## Python Implementation + +### [Solution](./Python/linearSearch.py) +```python + +""" +@author:NormalVad +@date:25/10/2020 +""" + + +def LinearSearch(a,n): + l = len(a) + found = False + i = 0 + while(i Date: Sun, 25 Oct 2020 22:18:21 +0530 Subject: [PATCH 5/9] Create Product.py product of two numbers --- day14/Python/Product.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 day14/Python/Product.py diff --git a/day14/Python/Product.py b/day14/Python/Product.py new file mode 100644 index 00000000..18f90e47 --- /dev/null +++ b/day14/Python/Product.py @@ -0,0 +1,28 @@ +""" +@author: NormalVad +@date: 25/10/2020 +""" + +def product(a,b): + if(a==0 or b==0): + return 0 + elif(b == 1): + return a + elif(a<0 and b<0): + a = a*(-1) + b = b*(-1) + return a + product(a,b-1) + elif(a>0 and b>0): + return a+product(a,b-1) + elif(a<0 and b>0): + a = a*(-1) + x = a+product(a,b-1) + return x*(-1) + else: + b = b*(-1) + x = a+product(a,b-1) + return x*(-1) + +print("Enter two numbers to be multiplied seperated by a space") +(a,b) = list(map(int, input().split())) +print(product(a,b)) From c204466ffde0b04b3d0a18f2c2226dfae6fc62a7 Mon Sep 17 00:00:00 2001 From: Ayush Goyal <73097046+NormalVad@users.noreply.github.com> Date: Sun, 25 Oct 2020 22:20:39 +0530 Subject: [PATCH 6/9] Update README.md --- day14/README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/day14/README.md b/day14/README.md index af3bc76d..7bde4683 100644 --- a/day14/README.md +++ b/day14/README.md @@ -495,3 +495,33 @@ void main(){ } ``` +### Python Implementation + +#### [Solution](./python/Product.py) +```python +@author:NormalVad +@date:25/10/2020 +def product(a,b): + if(a==0 or b==0): + return 0 + elif(b == 1): + return a + elif(a<0 and b<0): + a = a*(-1) + b = b*(-1) + return a + product(a,b-1) + elif(a>0 and b>0): + return a+product(a,b-1) + elif(a<0 and b>0): + a = a*(-1) + x = a+product(a,b-1) + return x*(-1) + else: + b = b*(-1) + x = a+product(a,b-1) + return x*(-1) + +print("Enter two numbers to be multiplied seperated by a space") +(a,b) = list(map(int, input().split())) +print(product(a,b)) +``` From 8425bb1cb46d0d7d850bb4f467322e5cfffd1885 Mon Sep 17 00:00:00 2001 From: Ayush Goyal <73097046+NormalVad@users.noreply.github.com> Date: Sun, 25 Oct 2020 22:23:39 +0530 Subject: [PATCH 7/9] Update README.md --- day14/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/day14/README.md b/day14/README.md index 7bde4683..c93c14eb 100644 --- a/day14/README.md +++ b/day14/README.md @@ -499,8 +499,10 @@ void main(){ #### [Solution](./python/Product.py) ```python +""" @author:NormalVad @date:25/10/2020 +""" def product(a,b): if(a==0 or b==0): return 0 From c6a85323a10398d0415288b5b0ba610905f79454 Mon Sep 17 00:00:00 2001 From: Ayush Goyal <73097046+NormalVad@users.noreply.github.com> Date: Mon, 26 Oct 2020 09:18:04 +0530 Subject: [PATCH 8/9] Update .all-contributorsrc --- .all-contributorsrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 4342ac5d..c595884a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -328,6 +328,16 @@ "doc", "code" ] + }, + { + "login": "NormalVad", + "name": "NormalVad", + "avatar_url": "https://avatars2.githubusercontent.com/u/73097046?v=4", + "profile": "https://github.com/NormalVad", + "contributions": [ + "doc", + "code" + ] } ], "commitConvention": "none" From db5711bfe009a387188ab00af65048e761d3999f Mon Sep 17 00:00:00 2001 From: Ayush Goyal <73097046+NormalVad@users.noreply.github.com> Date: Mon, 26 Oct 2020 09:20:27 +0530 Subject: [PATCH 9/9] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 39699d08..5c51040f 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -49,6 +49,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
GAURAV KUMAR

📖 💻
wboccard

📖 💻
d-l-mcbride

📖 💻 +
NormalVad

📖 💻