I am trying to understand why first code run only once vs second code is running until it checks all the items in the list.
1.
def get_word_over_10_char(list_of_words):
for word in list_of_words:
if len(word) > 10:
return word
else:
return ""
for word in list_of_words:
if len(word) > 10:
return word
return ''
word_list = ['soup', 'parameter', 'intuition', 'house-maker', 'fabrication']
Trying to return a word if length is more than 10, and return empty string if less than equal to 10.