Remove_duplicates


#1



https://www.codecademy.com/en/courses/python-intermediate-en-rCQKw/2/4?curriculum_id=4f89dab3d788890003000096#


This code returns an empty list irrespective of the input list. Can't figure the mistake.


def remove_duplicates(input_list):
    output_list=[]
    n=len(output_list)
    for x in range(0,n):
        if input_list[x] not in output_list:
            output_list.append(input_list[x])
    return output_list


#2

n is zero. Set using the input_list length.


#3

Thanks, so stupid of me!


#4

It happens. You don't deserve that label so push it out of your mind. Go easy on yourself. Expect to make mistakes and expect to fail. It's how we learn. Getting back on the horse and trying again is the best approach.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.