Added task 3
This commit is contained in:
20
basic programming/3rd task/7.py
Normal file
20
basic programming/3rd task/7.py
Normal 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()
|
||||
Reference in New Issue
Block a user