14/15 total bs


#1

def remove_duplicates(l):
results=l
for i in results:
for j in results:
if j==i:
results.remove(j)
return results
gives me an error that i’m modifying the input list, which i’m not, so i’m confused why it thinks that


#2

Oh, but you are. results and l point to the same list.

It is never a good idea to modify the list one is iterating. Perhaps consider creating an empty list, and append letters to it that are not already in it. Then return that list as a string.


#3

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