solution for quiz 3 q3 (unfinished)