I'm making an application in Python and so far I've managed to get the first letter of any word, and the last, but I can't get the letter in the middle.
It's easier if you already have the floor. For example:
If the word is: Leaf
The first letter is H, the central letter would be o, and the last letter is: a.
In Python it would be like this:
print("LETRAS DE UNA PALABRA")
palabra = "Hoja"
letra1 = palabra[0]
letraM = palabra[1]
letraF = palabra[3]
print("")
print("Las letras de la palabra [Hoja] son: ",letra1,"-","letraM","-",letraF)
This is how it would be if it were a fixed word, but in my case I have to get the middle letter of a random word entered by the user. And I don't really know how to do it.
I have this at the moment:
import time
print("POSICION DE LETRAS EN PALABRAS")
print("")
palabra = input("Ingrese una palabra: ")
last_p = len(palabra)
last_pl = palabra[last_p-1]
first_pl = palabra[0]
print(first_pl,"-",last_pl)
time.sleep(5)