def printPreOrder(root):
 if (root is None):
  return
 print root.data
 printPreOrder(root.left)
 printPreOrder(root.right)

def printPreOrder ( root ) : if ( root is None ) : return print root . data printPreOrder ( root . left ) printPreOrder ( root . right )
prints the tree in preorder .