Skip to content

adding new files (branch with master) #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 16, 2020
40 changes: 40 additions & 0 deletions Basic-Scripts/balanced_paranthesis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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)

38 changes: 25 additions & 13 deletions Contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,28 @@
If this is your first time to open source contribution in python So that I have created this repo for all the you to start contributing.

# How to contribute!
## Steps:
* fork the [repository](https://github.com/ankitdobhal/Python-Scripts)
* Clone the fork [repo](https://github.com/ankitdobhal/Python-Scripts)
(git clone https://github.com/ankitdobhal/Python-Scripts)
* Create new branch
(git checkout -b <Your-Branch-Name>)
* Add files in scripts folder
(git add <your-contribution>)
* Add a commit message !
(git commit -a -m "<Added your message>")
* Push changes
(git push origin)
* Create pull requests

## Steps:
- First commment on the issue in which you want to work upon.
- Issue-1 : https://github.com/ankitdobhal/Awesome-Python-Scripts/issues/91
- Issue-2 : https://github.com/ankitdobhal/Awesome-Python-Scripts/issues/92
- Issue-3 : https://github.com/ankitdobhal/Awesome-Python-Scripts/issues/93
- Issue-4 : https://github.com/ankitdobhal/Awesome-Python-Scripts/issues/94

- Fork the [repository](https://github.com/ankitdobhal/Awesome-Python-Scripts)

- Clone the fork [repo](https://github.com/ankitdobhal/Awesome-Python-Scripts)
- git clone https://github.com/ankitdobhal/Awesome-Python-Scripts
- Create new branch
- git checkout -b <Your-Branch-Name>

- Add Scripts related to your respective issues.
- git add <your-contribution>

- Add a commit message !
- git commit -a -m "<Added your message>"
- Push changes
- git push origin

- Create pull requests
- [Try to Mention the related issue for your PR]