+ 1
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
5 Respuestas
+ 2
thank you :)
+ 1
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
+ 1
i’m using python
+ 1
Check my code Nick. it is in python
0
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;
}