Just curious about the underlying len() formula, can someone tell me how len() calculate the length of range() please?
Hello @blog6154585042, welcome to the forums!
This article may be interesting. Essentially, every time you create an object that you can call
len() on, a “counter” (if you will) is updated in that object’s definition, and the
len() method simply accesses that. I would highly recommend reading the article I linked to, though.