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 DiPaolo5 Answers
New Answerdef 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
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; }
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message