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()