#14 Remove Duplicates Excercise


It takes a great deal for me to come out and ask for help, but this tiny bit of code is bugging me immensely.

  • Error Message: "Oops, try again. remove_duplicates([4, 5, 5, 4]) resulted in an error: argument of type 'NoneType' is not iterable"

def remove_duplicates(nums):
    for n in nums:
        if n not in cleannums:
            cleannums = cleannums.append(n)
    return cleannums

Thanks in advance.
Taylan U


Remove the cleannums = in cleannums = cleannums.append(n). You are assigning the variable to the action done on the variable...which makes Python confused hence that error pops up.


Well that solved it. +1 man.
I’m glad that this place exists for us.

@moderateurs this post can be closed at your earliest convenience.
Thanks to @datfatcat


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