Files
ba-degree/basic programming/3rd task/7.py
2024-12-21 23:50:13 +02:00

20 lines
418 B
Python

def duplicates_remove(txt: str) -> str:
seen = ""
result = ""
for char in txt:
if char not in seen:
result += char
seen += char
return result
def main_7ex():
txt1 = "banana"
print(f'{txt1} {duplicates_remove(txt1)}')
txt2 = "apple"
print(f'{txt2} {duplicates_remove(txt2)}')
txt3 = "pear"
print(f'{txt3} {duplicates_remove(txt3)}')
main_7ex()