Homework1-3 code