Last answered:

20 Jan 2022

Posted on:

20 Jan 2022


Code not working as shown in the video

Hello, I followed the above lesson and typed my code exactly as in the video but my code is having some error shown below when I try to run it. What can be the problem?

for i in range(len(data_copy)):
    for j in range(0,len(data_copy)-i-1):
        if data_copy[j] > data_copy[j+1]:

runfile('C:/Users/localadmin/.spyder-py3/', wdir='C:/Users/localadmin/.spyder-py3')
Traceback (most recent call last):

File "C:\Users\localadmin\.spyder-py3\", line 20, in <module>
    if data_copy[j] > data_copy[j+1]:

TypeError: '>' not supported between instances of 'list' and 'int'

1 answers ( 0 marked as helpful)
Posted on:

20 Jan 2022


Hey Jared,

Thank you for your question!

The problem is in the second to last line. The line should read:


where I have added [j] at the very end.

Unfortunately, in the video, the console panel is hiding the end of that line, so the [j] is not visible at all times. I would suggest downloading the resources for the course. The relevant code you can find in the file.

Hope this helps!

Kind regards,
365 Hristina

Submit an answer