Dictionary versus list for storing loss in Sigmoid Class

Hi All,
for plotting the loss and making a video of that during lecture Pratyush has used below code,

Sample Code:
####************************************************####

if display_loss:
            loss = {}

if display_loss:
                Y_pred = self.predict(X)
                loss[e] = mean_squared_error(Y_pred, Y)

if display_loss:
            plt.plot(loss.values())
            plt.xlabel('Epochs')
            plt.ylabel('Mean Squared Error')
            plt.show()

####************************************************####

But, when I am running the same code in my colab notebook i am getting the below error

TypeError: float() argument must be a string or a number, not ‘dict_values’

To rectify this, I modified the code like below and its working.

Modified Sample Code:
####************************************************####

if display_loss:
            loss = np.zeros(epochs)

if display_loss:
                Y_pred = self.predict(X)
                    loss[i] = (mean_squared_error(Y_pred, Y)).astype(np.float)

if display_loss:
            plt.plot(loss)
            plt.xlabel('Epochs')
            plt.ylabel('Mean squared Error')
            plt.show()

####************************************************####

My doubt, is why sample code is not working at my notebook. Is some installation etc require?

There were some updates in matplotlib later after the course was released.
Please use
list(loss.values())

my syntax is
plt.plot(list(loss.values()))
By doing that now there is no output in plot. I mean plot structure comes with no value.

Thanks Ishwar, I got the issue and resolved.
Thanks for your support