More Pythonic way

def inorder_iterative(node):
  result = ''
  stack = []
  while node or stack:
    if node:
      node = node.left
      node = stack.pop()
      result += str( + ' '
      node = node.right

  return result
1 Like

Hi @Vladimir_Ryabtsev,

Thank you so much for reaching out to us.

I really like your solution both of the solutions (this and in the course) give the same output and we also use the list in both of them but again, I like this one :slight_smile: .

If you have any other query then please do reach out to us. Thank you.