Below fails because strings are immutable. I am trying to remove duplicates in place. Is there a better way to do this?
def remove_duplicates_2(word):
write_index = 0
for i in range(len(word)):
found = False
for j in range(0, write_index):
if word[i] == word[j]:
found = True
break
if found == False:
word[write_index] = word[i]
write_index += 1
return word