Respuesta :
Answer:
- def processString(sentence):
- middle = len(sentence) // 2
- output = sentence[0: middle - 5] + sentence[middle+5:]
- return output
- print(processString("I have a dream"))
Explanation:
Create a function processString that take sentence as input paratemer (Line 1).
Next create a variable middle to hold the value of middle index of sentence string (Line 2)
Build the output string by slicing the input sentence from first character to character middle - 5th and from middle + 5th till the end of the string (Line 3).
Test the function using a sample sentence and we shall get the output "I am"
The function that takes a single string parameter and return everything but the middle 10 characters of the string is as follows:
def omitstring(string):
center = len(string) // 2
y = string[0: center - 5] + string[center + 5:]
return y
print(omitstring("I am definitely a brainly fans"))
Code explanation:
The code is written in python.
- We defined a function named "omitstring" and it has the parameter called "string".
- The variable "center" is used to divide the string into two.
- Now we cut the middle 10 numbers from the string.
- Then we return it.
- Finally, we call the function "omitstring" with the parameter.
learn more on python here: https://brainly.com/question/26967586
