Solution up to problem 6 assigment 2