From 5477a55d9eaa5d896d7cf4e259f88e3cae49e6d5 Mon Sep 17 00:00:00 2001 From: Raghav Agarwal <55791859+ragharwal@users.noreply.github.com> Date: Fri, 16 Oct 2020 23:40:03 +0530 Subject: [PATCH 1/6] Update CONTRIBUTING.md --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6b7caa6c4..c754e6e3a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,3 +40,4 @@ | Ankit Sharma | [@ANKITSHARMA98](https://github.com/ANKITSHARMA98) | | Nikhil Sachan | [@nikhil254](https://github.com/nikhil254) | | Ritik Bagora | [@ritik1999](https://github.com/ritik1999) | +| Raghav Agarwal | [@ragharwal](https://github.com/ragharwal) | From df6b96956d67da5ba16fa925f6f68caaa5912cc8 Mon Sep 17 00:00:00 2001 From: Ananya Sharma Date: Fri, 16 Oct 2020 23:58:44 +0530 Subject: [PATCH 2/6] Added palindrome partition --- Python/palindrome_partition.py | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Python/palindrome_partition.py diff --git a/Python/palindrome_partition.py b/Python/palindrome_partition.py new file mode 100644 index 000000000..87ceadcad --- /dev/null +++ b/Python/palindrome_partition.py @@ -0,0 +1,44 @@ +#palindrome_partition + +#Method to check whether the string is palindrome or not +def isPalindrome(string:str, start:int, end:int): + while start < end: + if string[end] != string[start]: + return False + start += 1 + end -= 1 + return True + +#Recursive method to search for all the possible partitions. +def findAllPartitions(allPartitions, subPartitions, initial, n, string): + if initial >= n: + x = subPartitions.copy() + allPartitions.append(x) + return + + for i in range(initial, n): + if isPalindrome(string, initial, i): + + subPartitions.append(string[initial:i + 1]) + + findAllPartitions(allPartitions, subPartitions, i + 1, n, string) + + subPartitions.pop() + +#Method to print all the possible palindrome partitions. +def palindromePartitions(string): + allPartitions = [] + subPartitions = [] + + findAllPartitions(allPartitions, subPartitions, 0, len(string), string) + + for i in range(len(allPartitions)): + for j in range(len(allPartitions[i])): + print(allPartitions[i][j], end = " ") + print() + +#Take a string input +string = str(input()) +palindromePartitions(string) + + From 46a9264812b88cf3c3e453adb85f206d77f316c6 Mon Sep 17 00:00:00 2001 From: AnanyaSharma22 Date: Sat, 17 Oct 2020 00:05:32 +0530 Subject: [PATCH 3/6] Update CONTRIBUTING.md Updated CONTRIBUTING.md with name and Github profile. --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6b7caa6c4..9699e5df8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,3 +40,4 @@ | Ankit Sharma | [@ANKITSHARMA98](https://github.com/ANKITSHARMA98) | | Nikhil Sachan | [@nikhil254](https://github.com/nikhil254) | | Ritik Bagora | [@ritik1999](https://github.com/ritik1999) | +| Ananya Sharma | [@AnanyaSharma22](https://github.com/AnanyaSharma22) | From e875f2283aa653ea38e687f38857b71be832f11a Mon Sep 17 00:00:00 2001 From: Ananya Sharma Date: Sat, 17 Oct 2020 00:38:29 +0530 Subject: [PATCH 4/6] Done some changes in palindrome partition --- Python/palindrome_partition.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Python/palindrome_partition.py b/Python/palindrome_partition.py index 87ceadcad..c81094abd 100644 --- a/Python/palindrome_partition.py +++ b/Python/palindrome_partition.py @@ -32,13 +32,11 @@ def palindromePartitions(string): findAllPartitions(allPartitions, subPartitions, 0, len(string), string) - for i in range(len(allPartitions)): - for j in range(len(allPartitions[i])): - print(allPartitions[i][j], end = " ") + for i in enumerate(allPartitions): + for j in enumerate(allPartitions[i[0]]): + print(allPartitions[i[0]][j[0]], end = " ") print() #Take a string input string = str(input()) -palindromePartitions(string) - - +palindromePartitions(string) \ No newline at end of file From 8e070083811feaa0c20f4cf9ec46c96cad0e8e8a Mon Sep 17 00:00:00 2001 From: Tanmay Khandelwal <58903502+Dude-901@users.noreply.github.com> Date: Sat, 17 Oct 2020 00:54:51 +0530 Subject: [PATCH 5/6] Create pc_health_check.py Check your pc disk usage and free space --- pc_health_check.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pc_health_check.py diff --git a/pc_health_check.py b/pc_health_check.py new file mode 100644 index 000000000..cd9799071 --- /dev/null +++ b/pc_health_check.py @@ -0,0 +1,28 @@ +# Check pc health status +# For a stable system, +# free space should be > 20% and, +# disk usage should be < 75% + +# pip install psutil + +import shutil +import psutil + + +def check_disk_usage(disk): + du = shutil.disk_usage(disk) + free = du.free / du.total * 100 + return free + + +def check_cpu_usage(): + usage = psutil.cpu_percent(1) + return usage + + +a = check_disk_usage("/") +b = check_cpu_usage() +if a > 20 or b < 75: + print("Pc is stable \nfree space: {:.2f}% \nCPU usage: {:.2f}%".format(a,b)) +else: + print("Error!!!\nAction required \nfree space: {:.2f}% \nCPU usage: {:.2f}%".format(a, b)) From 312c89be842664b4c949fdba325165384417690b Mon Sep 17 00:00:00 2001 From: Tanmay Khandelwal <58903502+Dude-901@users.noreply.github.com> Date: Sat, 17 Oct 2020 00:59:03 +0530 Subject: [PATCH 6/6] Update CONTRIBUTING.md --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6b7caa6c4..4f39dc2b5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,3 +40,4 @@ | Ankit Sharma | [@ANKITSHARMA98](https://github.com/ANKITSHARMA98) | | Nikhil Sachan | [@nikhil254](https://github.com/nikhil254) | | Ritik Bagora | [@ritik1999](https://github.com/ritik1999) | +| Tanmay Khandelwal | [@Dude-901](https://github.com/Dude-901) |