title: counting the number of elements of a list using recursive function without using len
body: <p>I saw this code:</p>
  <pre><code>def list_length(my_lis):
      if mylist:
          return 1 + list_length(my_lis[1:])
      return 0
  </code></pre>
  <p>This code counts the number of elements in the list recursively without using len function.
  Can someone please explain the list_length(my_lis[1:]) and how it gets added to 1 because from my understanding, my_lis[1:] gives the list without the first element. So how can this give the number of elements in a list?</p>