| f | """ | f | """ | 
            | n | This is a solution to homework 1 from the Introduction to Python course at FMI | n | This is a solution to homework 1 from the Introduction to Python course | 
            |  |  |  | at FMI by Nikolay Nikolaev. | 
            |  | """ |  | """ | 
            |  |  |  |  | 
            |  | def beginning(word): |  | def beginning(word): | 
            | n | """ | n | """Get the first part of a word.""" | 
            |  | function to get the first part of a word |  |  | 
            |  | """ |  |  | 
            |  | beg_ind = int(len(word)/3) |  | beg_ind = int(len(word)/3) | 
            |  | if len(word) % 3 == 2: |  | if len(word) % 3 == 2: | 
            |  | beg_ind += 1 |  | beg_ind += 1 | 
            | n | return word[0:beg_ind] | n | return word[:beg_ind] | 
            |  |  |  |  | 
            |  | def middle(word): |  | def middle(word): | 
            | n | """ | n |  | 
            |  | function to get the middle part of a word |  | """Get the middle part of a word.""" | 
            |  | """ |  |  | 
            |  | start_ind = int(len(word)/3) |  | start_ind = int(len(word)/3) | 
            | n | fin_ind = 2*start_ind | n | fin_ind = 2 * start_ind | 
            |  | if len(word) % 3 == 1: |  | if len(word) % 3 == 1: | 
            |  | fin_ind += 1 |  | fin_ind += 1 | 
            |  | elif len(word) % 3 == 2: |  | elif len(word) % 3 == 2: | 
            |  | start_ind += 1 |  | start_ind += 1 | 
            |  | fin_ind = 2*start_ind - 1 |  | fin_ind = 2*start_ind - 1 | 
            |  | return word[start_ind:fin_ind] |  | return word[start_ind:fin_ind] | 
            |  |  |  |  | 
            |  | def end(word): |  | def end(word): | 
            | n | """ | n | """Get the last part of a word.""" | 
            |  | function to get the last part of a word |  |  | 
            |  | """ |  |  | 
            |  | length = len(word) |  | length = len(word) | 
            | n | end_ind = 2*int(length/3) | n | end_ind = 2 * int(length/3) | 
            |  | if len(word) % 3 == 1: |  | if len(word) % 3 == 1: | 
            |  | end_ind += 1 |  | end_ind += 1 | 
            |  | elif len(word) % 3 == 2: |  | elif len(word) % 3 == 2: | 
            |  | end_ind += 1 |  | end_ind += 1 | 
            | n | return word[end_ind:length] | n | return word[end_ind:] | 
            |  |  |  |  | 
            |  | def split_sentence(sentence): |  | def split_sentence(sentence): | 
            |  | """ |  | """ | 
            | n | function that splits the words in a sentence into its three parts and saves | n | Splits the words in a sentence into their three parts and returns | 
            |  | them in a list as tuples |  | them in a list as tuples. | 
            |  | """ |  | """ | 
            |  | result = [] |  | result = [] | 
            | t | for word in sentence.split(sep=" "): | t | for word in sentence.split(): | 
            |  | result.append((beginning(word), middle(word), end(word))) |  | result.append((beginning(word), middle(word), end(word))) | 
            |  | return result |  | return result |