Kodewick
Start learning →
Mini challenge←→0 / 100

Guess the word

#040Mini challengeStringsLoops6 min

A word-guessing game: word is the secret word (lower case) and guessed holds the letters tried so far. Write show_guesses(word, guessed) to show the guessed letters and put _ for the others. Capitals in guessed count too.

Examples
show_guesses("apple", "ap")→'app__'
show_guesses("banana", "n")→'__n_n_'
show_guesses("kiwi", "")→'____'
main.py
def show_guesses(word, guessed):
    guessed = guessed.lower()
    shown = ""
    for ch in word:
        # your code here: guessed, add ch; if not, add "_"
        pass
    return shown
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.