Iterate until queue is empty
while length : NEW_LINE INDENT temp = que . pop ( 0 ) NEW_LINE print ( temp . val , end = ' ▁ ' ) NEW_LINE if temp . left : NEW_LINE INDENT que . append ( temp . left ) NEW_LINE DEDENT if temp . right : NEW_LINE INDENT que . append ( temp . right ) NEW_LINE DEDENT length -= 1 NEW_LINE DEDENT print ( ) NEW_LINE