Question: I have a function that checks if a given string is in a list of strings using a for and while loop. I’m not supposed to use the ‘in’ operator. Here’s my code using a for loop:

```
def word_in_list(words, word):
    for strings in words:
        if len(words) > 0 and strings == word:
            return True
        else:
            return False

```

However, it is not returning True unless the single string is the first element of the list. The list should return False in case the list is empty. And how can I solve the same problem using a while loop (and without 'in' operator)?

Answer: 
Don’t return `False` the moment you find one mismatch, return `False` when you are done checking all possibilities and not finding any match:

```
def word_in_list(words, word):
    for strings in words:
        if strings == word:
            return True
    return False

```

Also, no need to check the length of list every time, if it's zero, you don't run the loop at all and directly return `False`.
simly use this code

```
def word_in_list(words, word):
    if word in words:
       return True
    else
       return False

```