Remove all duplicate characters from a string

In this program, we will take a string as input and remove all duplicate characters from a string

Steps to solve the program
  1. Take a string as input.
  2. Import OrderedDict from collections to remove duplicate characters from a string.
  3. Print the output.
				
					#Input string
string = "sqatools"

#Importing ordereddict
from collections import OrderedDict

#Printing output
"".join(OrderedDict.fromkeys(string))
				
			

Output :

				
					'sqatol'
				
			

print characters at odd places in a string.

check if a string has a special character or not

Leave a Comment