Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

System Information #345

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .idea/.gitignore
Empty file.
8 changes: 8 additions & 0 deletions .idea/Awesome-Python-Scripts.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 97 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 38 additions & 40 deletions Basic-Scripts/balanced_paranthesis.py
Original file line number Diff line number Diff line change
@@ -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)
26 changes: 26 additions & 0 deletions System-Automation-Scripts/sys_info.py
Original file line number Diff line number Diff line change
@@ -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()