Basic algorithms for Python