Jun-24-2018, 01:00 AM
(This post was last modified: Jun-24-2018, 01:23 AM by gontajones.)
I did it starting the word 'apple' as a list ['a','p','p','l','e'] and every time a letter is a match I change it for '*'.
Try by yourself first and then I'll post my solution.
My solution:
Try by yourself first and then I'll post my solution.
My solution:
def checkLetter(letter, word, guess_word): for c in word: if c == letter: guess_word[word.index(c)] = c word[word.index(c)] = '*' return guess_word word = list('apple') guess_word = ['_' for x in word] print(guess_word) while '_' in guess_word: guess = input('Letter: ') print(checkLetter(guess, word, guess_word))