Dec-05-2017, 06:57 AM
i have several variables that at one point i expect them all to have the same value and need to test it:
... if a==b and b==c and c==d and d==e and e==f and f==g and g==h: print('they are all the same') else: print('it did not work')is there a better way to test if they are all alike? i can set it up so they are all in a list or tuple making up the whole sequence. i'm thinking maybe sorting a list and comparing first to last.