iterator pattern if __name__ ="__main__"tree mytree(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )print([ for in tree]resulting in an ordered list of values [ list comprehensions are fairly simple to understand they take function or operation and map it to an iterable you could also add some sort of conditional statement after the iteration to exclude certain elements let' alter the comprehension we just looked at to now ignore all multiples of once again list comprehension with an if ! if __name__ ="__main__"tree mytree(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )tree add_node(node( )print([ for in tree if ! ]as you would hopethe is not included in the final list[