Files
2024-12-21 23:50:13 +02:00

19 lines
452 B
Python

def split(txt: str) -> tuple:
space_index = 0
while txt[space_index] != ' ':
space_index += 1
part1 = txt[:space_index]
part2 = txt[space_index+1:]
return part1, part2
def main_4ex():
txt1 = "Hello World"
part1, part2 = split(txt1)
print(f'For input {txt1} we get {part1} and {part2}')
txt2 = "Leo Messi"
part1, part2 = split(txt2)
print(f'For input {txt2} we get {part1} and {part2}')
main_4ex()