Answers for "parenthesis checker python"

0

bracket balanced or not in python

def isBalanced(final_str):
    type_brackets = ['()', '{}', '[]']
    while any(x in final_str for x in type_brackets):
        for br in type_brackets:
            final_str = final_str.replace(br, '')
    return not final_str


string = "{[]{()}}"
print(string, "-", "Balanced"
      if isBalanced(string) else "Unbalanced")
Posted by: Guest on April-30-2020
0

parenthesis checker python

((1.- x)* cot(2.*x))/ ((1.-4.x-7.x**2)*(sin(2.*x) - 0.5))
Posted by: Guest on July-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language