If x is a list some of the items in x may themselves be


Python Question:

Write a function called depth. It is passed an object x, that may or may not be a list.

If x is a list, some of the items in x may themselves be lists, which also may or may not contain additional embedded lists.

The function returns the maximum depth of the embedded lists. For example:

The solution must be recursive
>>> depth(10)
0
>>> depth([1,2,3])
1
>>> depth([1,[2,3],4])
2
>>> depth([1,[3,1,2],[[3,6,2],[6,1,0,6]]])
3

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: If x is a list some of the items in x may themselves be
Reference No:- TGS02906997

Expected delivery within 24 Hours