14/ 15 remove duplicates


#1

14/ 15 remove duplicates
when i enter my code i am returned with the error
"Oops, try again. remove_duplicates([4, 5, 5, 4]) resulted in an error: 'list' object has no attribute 'apppend'" any idea as to how to fix this? Thanks

def remove_duplicates(list):
new_list=[]
for int in list:
if int not in new_list:
new_list.apppend(int)
return new_list
print remove_duplicates([1,1,1,1,1,1,4])

`


#2

Please note the spelling error in the above.

Aside:

Choose variable names that are not reserved words. int is a reserved word. Sure it might still work without conflict, but it makes reading of the code more difficult.


#3

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