Function 4: curve_fit
The function takes three input parameters: (1) a dictionary (any of the ones generated by the Load
Data module), (2) a string, and (3) an integer. The string indicates the attribute to which average
grades will be compared. Only attributes with numerical values are valid. The integer represents
the degree of the polynomial to be fitted to the data. You can assume that the order provided is
between 1 and 5 included.
Note: If the order provided is higher than the interpolating polynomial, you should discard the
order and do interpolation instead of regression. Example: You have 3 data points, and the order
provided is 5. In that case, you need to calculate the interpolating polynomial for the 3 data points.
The function will convert the student data to a list using the function student_list.
Then, the function will go through all students and store 'G_Avg' for each attribute level. Once
you have 'G_Avg' for each attribute level, you need to calculate the average. For example, if the
attribute is 'health', you need to find the average of 'G_Avg' for each 'health' level: 1, 2, etc.
Once the average values have been stored, the function will find the polynomial that best fits the
data. The degree of the polynomial is defined by the integer provided as input. Remember: if the
order provided is higher than the interpolating polynomial, you should do interpolation instead of
regression.
The function will return the equation of the best fit as a list of coefficients. The final function
must NOT have any print statements.