completed function homework assignment