Respuesta :
Following are the Python program to calculate the string value:
Program Explanation:
- Defining a method "sandwich" that takes string variable "x" in parameter.
- Inside the method, a return keyword is used that removes the middle string value.
- Outside the method, a print method is used that calls the "sandwich" method which accepts a string value in it and prints its return value.
Program:
def sandwich(x):#defining a method sandwich that takes string variable x in parameter
return x[0]+ x[-1]#using return keyword that remove middle string value
print(sandwich("pbj"))#calling method and print its return value
print(sandwich("blt"))#calling method and print its return value
Output:
Please find the attached file.
Learn more:
brainly.com/question/8647085
