I am trying to create this function as described in docstring but either I get just 1st doctest passed or fail with IndexError: list index out of range. I feel this current approach will work if somehow I can increment the loop counter again inside the loop without falling off range. I tried 

```
def menu_is_boring(meals):
"""Given a list of meals served over some period of time, return True if the
same meal has ever been served two days in a row, and False otherwise.

>>> menu_is_boring(['Egg', 'Spam'])
False
>>> menu_is_boring(['Spam', 'Eggs', 'Spam', 'Spam', 'Bacon', 'Spam'])
True

"""
for i in range(len(meals)):
    x = (meals[i] == meals[i+1]) and (meals[i] == meals[i+2])
return x

```

To solve the Index error I tried using while loop but that fails with syntax error:

```
for i in range(len(meals)):
    x = (meals[i] == meals[(while i<len(meals): i+=1 )]) and (meals[i] == meals[while i<len(meals):i+=2])

```

Will a nested loop somehow work or am I over complicating this? 

P.S. There is solution available to the problem but I am trying to see what is wront with my approach or get a hint , instead of jumping to the solution directly. This my 1st question so please excuse me if it is not following all the guidelines.