Code and homework for Week 3