Post History
Python 2, 37 bytes l=input() while 1:print len(l);l=l[0] Try it online! This makes heavy use of programs being allowed to terminate with error, which I assume is allowed by default because ...
Answer
#1: Initial revision
# [Python 2], 37 bytes <!-- language-all: lang-python --> l=input() while 1:print len(l);l=l[0] [Try it online!][TIO-khu9c4rz] [Python 2]: https://docs.python.org/2/ [TIO-khu9c4rz]: https://tio.run/##NYyxCsMgEIZ3n@JwUnBI29BCSsYO3bsdTulBhMOIWKpPb42hy9338d9/oaR18@f6XR0TnCYBKZaJMi1Sysqz8@GTlBb/PETnEzB5xfrOM@Nga7sUQHmhkEA9/ZvyI8YtGniVQB11@wu9WtGK1hGItg9z7NGMDQdz6Ya7XO3BeNuTJvYH "Python 2 – Try It Online" This makes heavy use of programs being allowed to terminate with error, which I assume is allowed by default because it is on SE. We repeatedly print the length, and then replace the list with its first entry. This will fail when we're at a leaf, which is when the list is empty or is actually a number.