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,18 @@
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()