Some more python algorithms