Interview Question

Software Development Engineer Interview(Student Candidate) Hyderābād (India)

Remove repeated characters from a string

Answer

Interview Answer

1 Answer

1

Answer in python:

string = "hello David, how are you doing?"
string2 = ""

for letter in string:
    if (not letter in string2) or letter == " ":
        string2 = string2 + letter

print string
print string2

Python Answer on Feb 3, 2013

Add Answers or Comments

To comment on this Question, Sign In with Facebook or Sign Up