I am learning to use python and there is one thing that I can not do, I want to make a loop for when I ask a question, just let me put one of these letters a, b, c, d, e
that in the first run, after that ask me again which letter I want to choose, but now I can choose 5 more that is% a, b, c, d, e, f, g, h, i, j
and in the next print 5 more letters and so on until I reach 25 letters.
I paste down what I have done, it works well, it does not let me put numbers or the other letters, the problem is when I put two letters (for example hj
) peta if you could help me or do it in some other way than I would like to thank you.
cuantas_frutas_coger = 5
letra = 97 #Es la letra a en ASCII
jugador = '1'
while not jugador.isalpha() or ord(jugador) > letra+cuantas_frutas_coger:
print ('Elige una letra entre a y ', chr(letra+cuantas_frutas_coger))
jugador = input('')
I do not know if I've explained myself well, it's a game in which you first have to take 5 letters, if you win there are 10, if you win again 15 and only that piece is missing. Thanks.