ParanthesisTreePrinter.py
def paranthesesChecker(tree):
	'''
		Check if given tree has equal number of closing and opening square brackets using the paranthesesStack
		input : tree as string
		output : boolean value indicating paranthesesCheck
	'''
	paranthesesStack = []

	#try-except required to ensure you dont pop from an empty list, which means we get a closing bracket before an opening one
	try:	
		for elem in tree:
			if(elem == "["):
				paranthesesStack.append(elem)
			elif(elem == "]"):
				paranthesesStack.pop()
		if(len(paranthesesStack) == 0):
			return True
		else:
			return False
	except:
		return False

		Check if given tree has equal number of closing and opening square brackets using the paranthesesStack
		input : tree as string
		output : boolean value indicating paranthesesCheck
	
Check if given tree has equal number of closing and opening square brackets using the paranthesesStack
input : tree as string
output : boolean value indicating paranthesesCheck
Check if given tree has equal number of closing and opening square brackets using the paranthesesStack input : tree as string output : boolean value indicating paranthesesCheck
def paranthesesChecker(tree):
	paranthesesStack = []
	try:	
		for elem in tree:
			if(elem == "["):
				paranthesesStack.append(elem)
			elif(elem == "]"):
				paranthesesStack.pop()
		if(len(paranthesesStack) == 0):
			return True
		else:
			return False
	except:
		return False
def paranthesesChecker ( tree ) : paranthesesStack = [ ] try : for elem in tree : if ( elem == "[" ) : paranthesesStack . append ( elem ) elif ( elem == "]" ) : paranthesesStack . pop ( ) if ( len ( paranthesesStack ) == 0 ) : return True else : return False except : return False
Check if given tree has equal number of closing and opening square brackets using the paranthesesStack
input : tree as string
output : boolean value indicating paranthesesCheck
Check if given tree has equal number of closing and opening square brackets using the paranthesesStack input : tree as string output : boolean value indicating paranthesesCheck
'''
		Check if given tree has equal number of closing and opening square brackets using the paranthesesStack
		input : tree as string
		output : boolean value indicating paranthesesCheck
	''' #try-except required to ensure you dont pop from an empty list, which means we get a closing bracket before an opening one
tree