ex10-12.py 문장의 중복 글자 제거 (continue)

10 P
QUESTION 12 #682
문장에서 이미 본 글자가 또 나오면 건너뛰고, 처음 보는 글자만 출력합니다. 빈칸에 들어갈 알맞은 키워드를 채우세요.
main.py
string = "There is no place like home."

list1 = []
output = ""

for x in string :
    if x in list1 :
        
    else:
        output = output + x
        if x != " " :
            list1.append(x)

print(string)
print(output)
실행 결과 예시
There is no place like home.
Ther is nopalkm.
INTERACTIVE SHELL Shift + Enter 로 즉시 실행