<qiyuangong>144_Binary_Tree_Preorder_Traversal_1.py
def preorderTraversal( root):
    if root is None:
        return []
    res = []
    stack = [root]
    while len(stack) > 0:
        curr = stack.pop()
        res.append(curr.val)
        if curr.right is not None:
            stack.append(curr.right)
        if curr.left is not None:
            stack.append(curr.left)
    return res
def sample_funcname ( var_0 ) :
    if var_0 is None :
        return [ ]
    var_2 = [ ]
    var_3 = [ var_0 ]
    while len ( var_3 ) > 0 :
        var_7 = var_3.pop ( )
        var_2.append ( var_7.val )
        if var_7.right is not None :
            var_3.append ( var_7.right )
        if var_7.left is not None :
            var_3.append ( var_7.left )
    return var_2
