Unable to figure out mistake in the code

I followed the instructions given in the hint video.

How to do this question?
you can refer to this, in this thread, it also has the correct code