Question: Python pls Create a recursive function max_nested. this function takes an int or list(nested list) and returns an int of what is a deepest nested
Python pls
Create a recursive function "max_nested". this function takes an int or list(nested list) and returns an int of "what is a deepest nested list?"
def max_nested (taker):
pass
a = [1, [2], 3]
print(max_nested(a))
output = 2 (because [2] is in the list and list) [1,[2],3] => [2] => 2
b = [[1,2,[3,[4],5],[7,9,8]], [2,2]]
print(max_nested(b))
output = 4 (because 4 is inside the list 4 times = [[1,2,[3,[4],5],[7,9,8]], [2,2]] => [1,2,[3,[4],5],[7,9,8] => [3,[4],5] => [4] => 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
