tutorial 1 adapted for homework method