Tell us what’s happening:
I am trying to add the entry for 2050 year as mentioned in the project. But somehow the even though I have added the entry the test case fails with following error:

self.assertEqual(actual, expected, “Expected different line for first line of best fit.”)
AssertionError: Lists differ: [-0.5[2613 chars]87559] != [-0.5[2613 chars]87559, 7.905850232699706, 7.968894816711838, 8[634 chars]2443]

Second list contains 36 additional elements.
First extra element 134:
7.905850232699706

Your code so far
So here is what I did to add the entry for year 2050 in the existing dataset #New year vallue
a = 2050 #Find corresponding y value using the intercept and slope for the best line calculated earlier
b= intercept + slopea #Append these values to the existing dataset
df= df.append({‘Year’:2050,‘CSIRO Adjusted Sea Level’: b}, ignore_index=True)
x=df[‘Year’]
y=df[‘CSIRO Adjusted Sea Level’] #Find the slope and intercept passing through the year 2050
slope, intercept, r_value, p_value, std_err = linregress(x,y)
plt.scatter(x=‘Year’,y=‘CSIRO Adjusted Sea Level’,data=df)
plt.plot(x, intercept + slopex, ‘r’, label=‘fitted line’)
plt.xlabel(‘Year’)
plt.ylabel(‘Sea Level (inches)’)
plt.title(‘Rise in Sea Level’)

I am not sure what I am doing wrong and why the test modules have extra intercept values.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36.

I guess thats what I have done here. I found the slope and intercept from the known data from the original dataframe then by using the this slope and intercept I found the value for year 2050. My concern is althought the intercept value for 2050 is somewhat similar. I seem to be missing the intercept values from between. The last year in the given dataframe is 2013. Do we need to find values for all the years between 2013-2050? My last intercept value is 7.842805648687559 what about these values as expected by test?
7.905850232699706,

You are finding the sea level value for year 2050 and years in-between from the calculated slope and intercept of the best fit line. In calculations, based on these parameters, both slope and intercept shouldn’t change (otherwise it wouldn’t be linear equation), what changes is the x (year) and the resulting sea level. Tests don’t check slope or intercept directly.

Thank you this helped much. Thats what I wanted to know. Basically I was just trying to plot line for 2050 and skipped all the years in between. Mat be I got the problem statement wrong. Plotting the data between 2014 to 2050 solved it for me.