You are viewing a single comment's thread. Return to all comments →
You can also use stdout.write from systo suppress newlines:
sys
import sys # (...) sys.stdout.write(str(root.data) + ' ')
I've no idea why Python 3 is not available here. end='' in a print function is so much more explicit and readable.
end=''
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Preorder Traversal
You are viewing a single comment's thread. Return to all comments →
You can also use stdout.write from
sys
to suppress newlines:I've no idea why Python 3 is not available here.
end=''
in a print function is so much more explicit and readable.