Week 3 code assignment


Hello
What does formatting = " "*current_depth + “-”*current_depth, and formatting = “-”*current_depth functions do ?

It is used to generate indentation strings recursively for visualizing the structure of the tree.

  • " " * current_depth: This part generates a string consisting of current_depth number of spaces. It creates indentation for the current depth level of the tree.

  • "-" * current_depth: This part generates a string consisting of current_depth number of hyphens. It shows the branches of the tree.

1 Like