14. remove_duplicates



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:
    return output_lst
    print output_lst


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.


Thank you very much for your aid and quick response.


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