homework 2 - exercise1 almost complete.

Yet I feel there is a lot of repetition. Not good :(