14. remove_duplicates


#1



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


My code runs and allows me to progress to the next lesson, however, I was wondering why it will not actually print out the lst after removing the duplicates.

def remove_duplicates(lst):
    input_lst = lst
    output_lst = []
    for a in input_lst:
        if a not in output_lst:
            output_lst.append(a)
    return output_lst
    print output_lst


#2

You should put the print statement before your return statement. return ends the function completely so your print statement will never be reached if it's after return.


#3

Thank you very much for your aid and quick response.


#4

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