put the loop into a function
added the second argument to the function
finished ex35