Solved a couple algorithms in python