def remove_duplicates(s):
t=0
a=s[0]
while t <= len(s):
x=0
while x <= len(a):
if s[t] != a[x]:
a+=s[t]
x+=1
t+=1
return a
print(remove_duplicates("zeebra")) #=zebra
print(remove_duplicates("aaaaaa")) #=a
The goal of this code is to remove the duplicates in any string
instead, I'm getting the output:
line 7, in remove_duplicates if s[t] != a[x]:
IndexError: string index out of range