14/15 what does "out of range" means?


Here's my code:

def remove_duplicates(lst):

new_lst = []

for i in range(len(lst)):

if i not in new_lst[i]:

return new_lst

however i met an error, i was told "remove_duplicates([4, 5, 5, 4]) resulted in an error: list index out of range"

So... What does "out of error" means? And why does my code out of range?



def remove_duplicates(lst):
    #create an =empty= list
    new_lst = []
    #run through all elements of the given =lst=
    for i in lst:
        #Test if element found in =lst=
        #exists in =new-lst=
        if i not in new_lst:
            #if not yet in =new-lst=, then append()
    #after running through all of =lst= Elements
    #return the =new-lst=
    return new_lst

print remove_duplicates([4, 5, 5, 4])