Driver function to test above problem
if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT root = node ( ' + ' ) NEW_LINE root . left = node ( ' * ' ) NEW_LINE root . left . left = node ( '5' ) NEW_LINE root . left . right = node ( '4' ) NEW_LINE root . right = node ( ' - ' ) NEW_LINE root . right . left = node ( '100' ) NEW_LINE root . right . right = node ( '20' ) NEW_LINE print evaluateExpressionTree ( root ) NEW_LINE root = None NEW_LINE root = node ( ' + ' ) NEW_LINE root . left = node ( ' * ' ) NEW_LINE root . left . left = node ( '5' ) NEW_LINE root . left . right = node ( '4' ) NEW_LINE root . right = node ( ' - ' ) NEW_LINE root . right . left = node ( '100' ) NEW_LINE root . right . right = node ( ' / ' ) NEW_LINE root . right . right . left = node ( '20' ) NEW_LINE root . right . right . right = node ( '2' ) NEW_LINE print evaluateExpressionTree ( root ) NEW_LINE DEDENT