Rewrote question 1 in python. a little easier to express.