If you have a list = [1,2,3,4,5]
how would you recursively calculate the length of that list without using len(list)?
myarray = [1,2,3,4,5]
def mylist(myarray):
if (myarray == []):
print ("The list is empty")
return
return 1 + ?
Don't want to use len but just add 1 each time there exists a value in list. How would I do that?