Start popping nodes from stack and print them
while len ( stk ) != 0 : NEW_LINE INDENT curr = stk [ - 1 ] NEW_LINE stk . pop ( - 1 ) NEW_LINE print ( curr . data , end = " ▁ " ) NEW_LINE DEDENT print ( ) NEW_LINE