How to check if a range in a list is the same in python? : I want to check if a certain range in a list is the same. For example:
In a list I have X,Y,X,X,X,Y,Y, i want to see if the third, fourth and fifth are the same.
I have tried the following:

    list = ['X', 'Y', 'X', 'X', 'X', 'Y']
    for i in list, range(2,4):
        if not i == 'X':
            print("Test")

It does work but prints Test twice.

    Test
    Test

I just don't want to write a bunch of this:
if ... and .... and ..... and ... or .... and ...