Answer:
# The function reverseLetter is defined
def reverseLetter(received_word):
# The first letter of the word is assigned to a variable using index 0
firstLetter = received_word[0]
# The last letter of the word is assigned to a variable using index of
# string length - 1
lastLetter = received_word[len(received_word) - 1]
# reverse letters in between first and last letter is defined as
# empty string
reverseBetween = ""
# A counter is defined to control the loop during the reversal
# counter value is 2 from the length of the received string
# The 2 is for the first and last letter remove
counter = len(received_word) - 2
# The while loop start
while counter >= 1:
# The reverseBetween string is concatenated with corresponding
# index of received word
# The index is from high to low since the process is string reversal
reverseBetween += received_word[counter]
# The value of counter is decremented
counter -= 1
# The reversed string is displayed with no separator
print(firstLetter, reverseBetween, lastLetter, sep="")
Explanation:
The code is well commented.
reverseLetter("come") will output cmoe
reverseLetter("welcome") will output wmoclee
reverseLetter("brainly") will output blniary