Q. Write a Python program to remove duplicate characters of a given string.

Answer =

string = input("Enter a string :- ")
new_str = ""
for i in string:
    if i not in new_str :
        new_str += i
print(new_str)

Output :-

Enter a string :- Pathwalla
Pathwl

>>> 

Enter a string :- Portal Express
Portal Expes

>>>

4 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post