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

25 lines
592 B
Python

def duplicates_has(txt: str) -> str:
seen = ""
for char in txt:
if char in seen:
return char
seen += char
return None
def main_6ex():
txt1 = "banana"
result = duplicates_has(txt1)
if result:
print(f'In {txt1} {result} appears more than once')
else:
print(f'In {txt1} no character appears more than once')
txt2 = "pear"
result = duplicates_has(txt2)
if result:
print(f'In {txt2} {result} appears more than once')
else:
print(f'In {txt2} no character appears more than once')
main_6ex()