diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/.idea/Awesome-Python-Scripts.iml b/.idea/Awesome-Python-Scripts.iml new file mode 100644 index 00000000..d0876a78 --- /dev/null +++ b/.idea/Awesome-Python-Scripts.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..d1e22ecb --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..dc1aff6b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..f0856507 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1622104567583 + + + + + + + \ No newline at end of file diff --git a/Basic-Scripts/balanced_paranthesis.py b/Basic-Scripts/balanced_paranthesis.py index 7709f1b8..3d9d89f8 100644 --- a/Basic-Scripts/balanced_paranthesis.py +++ b/Basic-Scripts/balanced_paranthesis.py @@ -1,40 +1,38 @@ -openBracketList = ["[", "{", "("] -closeBracketList = ["]", "}", ")"] - - -def check_parentheses(data: str) -> str: - """ - check_parentheses() : Will take a string as an arguement and each time when an open parentheses is encountered - will push it in the stack, and when closed parenthesis is encountered, - will match it with the top of stack and pop it. - - Parameters: - data (str): takes a string. - - Returns: - str: Returns a string value whether string passed is balanced or Unbalanced. - """ - stack = [] - for index in data: - if index in openBracketList: - stack.append(index) - elif index in closeBracketList: - position = closeBracketList.index(index) - if (len(stack) > 0) and ( - openBracketList[position] == stack[len(stack) - 1] - ): - stack.pop() - else: - return "Unbalanced" - if len(stack) == 0: - return "Balanced" - else: - return "Unbalanced" - - -if __name__ == "__main__": - - data = input("Enter the string to check:\t") - result = check_parentheses(data) - print(result) - +openBracketList = ["[", "{", "("] +closeBracketList = ["]", "}", ")"] + + +def check_parentheses(data: str) -> str: + """ + check_parentheses() : Will take a string as an arguement and each time when an open parentheses is encountered + will push it in the stack, and when closed parenthesis is encountered, + will match it with the top of stack and pop it. + + Parameters: + data (str): takes a string. + + Returns: + str: Returns a string value whether string passed is balanced or Unbalanced. + """ + stack = [] + for index in data: + if index in openBracketList: + stack.append(index) + elif index in closeBracketList: + position = closeBracketList.index(index) + if (len(stack) > 0) and ( + openBracketList[position] == stack[len(stack) - 1] + ): + stack.pop() + else: + return "Unbalanced" + if len(stack) == 0: + return "Balanced" + else: + return "Unbalanced" + + +if __name__ == "__main__": + data = input("Enter the string to check:\t") + result = check_parentheses(data) + print(result) diff --git a/System-Automation-Scripts/sys_info.py b/System-Automation-Scripts/sys_info.py new file mode 100755 index 00000000..b872d44c --- /dev/null +++ b/System-Automation-Scripts/sys_info.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import platform + +info = { + # System/OS + 'System Type': platform.system(), + 'Host Name': platform.uname()[1], + 'Release': platform.release(), + 'Version': platform.version(), + 'Python Version': platform.python_version(), + +} + + +def main(): + print( + "\n" + "============System Information============\n" + ) + for sys_key, sys_val in info.items(): + print(sys_key, ":", sys_val) + + +if __name__ == '__main__': + main()