Python: Length from scratch
def py_length(x): out = 0 for i in x: out += 1 return out py_generator = range(1, 21) result = py_length(py_generator) print(result) #> 20