1 def match(word_list, expecting):
2 if word_list:
3 word = word_list.pop(0)
4
5 if word[0] == expecting:
6 return word
7 else:
8 return None
9 else:
10 return None
It’s the code for match function above.
How I see the function is that the function
1.) takes a list of words and the expecting word type as arguments,
2.) takes the first word of the list,
3.) and compares the first letter of that first word to the expecting word type to check if the two are equal, and etc.
If I understood the code correctly, then the two should never be equal, right? Then isn’t there something wrong or am I missing something?