Your question is Print Meta View Hierarchy. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
In a Meta mobile app such as Facebook or Instagram, UI debugging often requires inspecting the full view tree from a root view. Given the root of a view hierarchy, return a formatted list of strings representing the entire hierarchy in top-down order, with indentation showing parent-child relationships.
Each view has a name string and a list of children. Write a function that traverses the hierarchy and returns one string per view. The root should have no indentation, its children should be prefixed with two spaces, grandchildren with four spaces, and so on.
root, a view node object or Nonename: stringchildren: list of child view nodesdef print_view_hierarchy(root=None, name=None, children=None):