If i had a word that had space, like abc def
for user to guess, and i want to input the space, so user don't have to guess the space.
Beacuse i had a code like this:
if len(letter)==1 and letter.isalpha():
if letters_tried.find(letter) != -1:
开发者_开发知识库Befor user gusee is:
_ _ _ _ _ _ _
If guess the letter:
abc_def
is missing the space.
I want user only input alpha and i'll input the space for user. Is there away to do it?
Maybe you are looking for next:
inputs = ["abc def", ...]
inputs_map = zip(inputs, [i.replace(' ', '') for i in inputs])
user_input = get_user_input()
user_input = inputs_map.get(user_input, user_input)
精彩评论