solution for final exercises 17