solution for exercise 7
solution for exercise 8