The function below takes a single string parameter: sentence. Complete the function to return everything but the middle 10 characters of the string. You can assume that the parameter always has at least twelve characters and is always an even number of characters long. Hint: To find the middle of the string, you can half the length of the string (floor division). Then slice out 5 less than the middle to 5 more than the middle.

Respuesta :

Answer:

def get_middle_ten(sentence):

   ind = (len(sentence) - 12) // 2

   return sentence[ind:ind + 12]

# Testing the function here. ignore/remove the code below if not required

print(get_middle_twelve("abcdefghijkl"))

print(get_middle_twelve("abcdefghijklmnopqr"))

print(get_middle_twelve("abcdefghijklmnopqrst"))