0
def remove_duplicates (user_input):
    black_list = []
    new_list = []
    for i in user_input:
        for t in black_list:
            if i == t:
                break
            else:
                new_list.append(i)
                black_list.append(i)
    return new_list

I've been taking classes from codecademy and I tried to tackle a problem this way but the second loop doesn't seem to be executing and I've check via print statements throughout the loops but I can't seem to get it to work.

1 Answer 1

2

black_list is declared empty, []. Therefore the 2nd for-loop will execute 0 iterations.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.