Added task 3

This commit is contained in:
2024-12-21 23:50:13 +02:00
parent 94318de22d
commit 82ac1fcf4d
7 changed files with 133 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
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()