knapply
11/5/2018 - 6:14 PM

Python: Length from scratch

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