Finished homework for week 6 (Part I)