edited exercise 7 from arrays