For some reason x in this code is not updating within the recursion. Shouldn't x update as I'm calling b(c) within a(y)? When x updates in b(c) but doesn't return to
global nested
def extract(nested,depth):
y = depth[0]
depth = depth[1:]
extract = nested[y]
newlist(extract)
return depth
def newlist(x):
nested = x
return nested
def recursiveRef(nested,depth):
"""Return element from nested list
list ->int
"""
if len(depth) == 0:
return nested
else:
return recursiveRef(nested,extract(nested,depth))
x = b(c)not justb(c). Not sure on pythondepthanywhere (not initialized it, nor are you incrementing it). Can you please update the code?