added lesson 5 to define the average function