human
Remove duplicates from a given string | Function to make the string unique.
loop to traverse the string and check for repeating chars using IndexOf ( ) method in Java.
character at i 'th index of s.
if c is present in str , it returns the index of c , else it returns - 1 print ( st . index ( c ) ).
adding c to str if - 1 is returned.
Driver code.
Input string with repeating chars"
How can the above be solved in Python?
assistant
#Here is code to remove duplicates from a given string and the other steps required.
 def unique ( s ) :
	st = " "
	length = len ( s )
	for i in range ( length ) :
		c = s [ i ]
		if c not in st :
			st += c
	return st
if __name__ == " _ _ main _ _ " :
	s = " geeksforgeeks "
	print ( unique ( s ) )