Homework 3 code