0 out of 68 challenges solved

Calculate the depth of a tree

Write a function called calculate_depth_tree that takes a tree structure as input and calculates the depth of the tree. The tree structure is represented as nested lists, where each list can contain either numbers or nested lists. The depth of a tree is the maximum number of levels or nested lists in the tree. The function should return the calculated depth.

Input: [1, [2, [3, 4], 5], 6]
Output: 4

def calculate_depth_tree(tree):
    Calculates the depth of a tree structure.

    tree (list): The input tree structure.

    int: The calculated depth.
    # TODO: Implement the calculate_depth_tree function