mardi 20 septembre 2016

Compare variable to multiple variables in If statement - Python [duplicate]

This question already has an answer here:

Is there a way in python to compare multiple variables to other variables in an if statement? Like the following:

if(a != {b,c,d,e,f,g,h,i,j} and b != {c,d,e,f,g,h,i,j} 
   and c != {d,e,f,g,h,i,j} and d != {e,f,g,h,i,j} and 
   e != {f,g,h,i,j} and f != {g,h,i,j} and g != {h,i,j} 
   and h != {i,j} and i != j):

This code runs, but does not test the variable with every other variable in the list.

Aucun commentaire:

Enregistrer un commentaire