powered by
This function will search for the first block of parenthesis and return it if found. Otherwise, it will return "".
find_parenthesis(text)
a substring. Either "" or the first parenthesis block.
the string/code/statement you want to parse.
# returns "" find_parenthesis("3 + 5") # returns "(3 + 5)" find_parenthesis("2 * (3 + 5)")
Run the code above in your browser using DataLab