expression tree evaluation the numeric evaluation of an expression tree can be accomplished with simple application of postorder traversal if we know the values represented by the two subtrees of an internal positionwe can calculate the result of the computation that position designates pseudo-code for the recursive evaluation of the value represented by subtree rooted at position is given in code fragment algorithm evaluate recur( )if is leaf then return the value stored at else let be the operator stored at evaluate recur(left( ) evaluate recur(right( )return code fragment algorithm evaluate recur for evaluating the expression represented by subtree of an arithmetic expression tree rooted at position to implement this algorithm in the context of python expressiontree classwe provide public evaluate method that is invoked on instance as evaluatecode fragment provides such an implementationrelying on nonpublic evaluate recur method that computes the value of designated subtree def evaluate(self)"""return the numeric result of the expression ""return self evaluate recur(self root)def evaluate recur(selfp)"""return the numeric result of subtree rooted at ""if self is leaf( )return float( element)we assume element is numeric elseop elementleft val self evaluate recur(self left( )right val self evaluate recur(self right( )if op =return left val right val elif op =return left val right val elif op =return left val right val treat or as multiplication elsereturn left val right val code fragment support for evaluating an expressiontree instance