1def split_to_parts(word):
2 left=len(word)//3
3 right=len(word)-left
4 if len(word)%3==2:
5 left+=1
6 right-=1
7 return (word[:left],word[left:right],word[right:])
8
9def beginning(word):
10 return split_to_parts(word)[0]
11
12def middle(word):
13 return split_to_parts(word)[1]
14
15def end(word):
16 return split_to_parts(word)[2]
17
18def split_sentence(sentance):
19 return [split_to_parts(i) for i in sentance.split()]
............
----------------------------------------------------------------------
Ran 12 tests in 0.000s
OK
16.10.2023 16:44
16.10.2023 16:44
16.10.2023 16:44