range index and len
Similar to strings, lists, and tuple, but unlike filehandles, we can use the len
function on the range
object and we can also access a specific element
using the square-bracket indexing without actually iterating over all the elements.
rng = range(10, 10000, 2)
print(rng[2])
print(len(rng))
Output:
14
4995