Guess letter in word | Sololearn: Learn to code for FREE!


Guess letter in word

I have to define a function letter_in_word(guess, word) that returns True if Guess is a letter in the word and False if it is not

1/28/2018 11:56:18 PM

Nick DiPaolo

5 Answers

New Answer


thank you :)


def letter_in_word(guess, word): if guess in word: return True else: return False Test it: print(letter_in_word("a", "cat")) print(letter_in_word("a", "dog")) output: True False


i’m using python


Check my code Nick. it is in python


which language? depending on that your string data type provides functions to search for substring(your guess) in another string(your word) in JavaScript function letter_in_word(guess, word){ return word.indexOf(guess)>-1; }