Solution for Pro1.4 of Week3