Answer:
Written in Python:
def list_length(shrinking_list):
if not shrinking_list:
return 0
else:
return list_length(shrinking_list[1:]) + len(shrinking_list[0])
Step-by-step explanation:
This defines the list
def list_length(shrinking_list):
This checks if list is empty, if yes it returns 0
if not shrinking_list:
return 0
If list is not empty,
else:
This calculates the length of the list, recursively
return list_length(shrinking_list[1:]) + len(shrinking_list[0])
To call the function from the main, use:
print(list_length(listname))