algorithms on python