The answer to Strings and Conditionals (Part One) has a simple loop to go through all the letters in a word to determine if a specific letter is in that word. If the letter exist then return True. My confusion comes in the structure.
The code creates a “for” loop followed by an “if” statement. If while looping through the word the letter is uncovered the “if” statement returns True. HOWEVER, once the “for” loop is done there is then ANOTHER RETURN (return False). This False return is outside the “if” statement. Why does the code not always return False? Why does it skip the False return if the “if” statement above it returns True?
def letter_check(word, letter):
for character in word:
if character == letter:
return False <—