def remove_duplicates(stuff): single = [ ] for i in stuff: x = stuff[i] if i not in stuff[x:]: single.append(i) return single
And I don't know how to indent my code here.
Have you checked the community forum for tips and resources and how to format code samples?
Ok, I solved it differently. But would still be interesting to know how it's working.
You still didn't locate that article on how to format code samples, did you? If you want us to help you, then take the time to read and learn how to format code.
What is more, new topics have a template built in if one takes the time to read and follow the instructions written there. Code may be pasted in to the section indicated ("Replace this line with your code").
Now, I did. Was just busy and tired. Would be glad if you'd help me.
Much better. Thanks for looking that up.
single = 
Normally, an empty list is written without a space inside. May not matter, though.
x = stuff[i]
i is already an item from the list. It is not an index.
if i not in single:
Be sure your return line is in the function. Indent with four spaces.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.