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], and 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, prints Test twice.
Test
Test
I just don't want to write a bunch of this:
if ... and .... and ..... and ... or .... and ...