Answers for "program to parenthesize an expression"

0

program to parenthesize an expression

def p(e):
 for o in"+-*/":
    for i,c in enumerate(e):
        if(c==o)*(0==sum([(d=="(")-(d==")")for d in e[:i]])):return"("+p(e[:i])+o+p(e[i+1:])+")"
 return e
Posted by: Guest on May-13-2020

Code answers related to "program to parenthesize an expression"

Code answers related to "Javascript"

Browse Popular Code Answers by Language