I'm trying to create a program which requires any one of eight lists to equal a separate list. I have several list variables: testC1, testC2, etc and xwin, as well as one string: result It's hard to explain, so here's the code:
result = ("n")
print ("testD1 is:",str(testD1)) #Debugging
print ("xwin is:",str(xwin)) #Debugging
if (testC1 or testC2 or testC3 or testR1 or testR2 or testR3 or testD1 or testD2) == (xwin):
result = ("x")
else:
pass
print (result) #Debugging
And when the code is run, I get the following result:
>>> testD1 is: ['x', 'x', 'x']
>>> xwin is: ['x', 'x', 'x']
>>> n
I would expect to get "x" as the result, as I only want to check if one (or more) of the lists (in this case, testD1)to be identical to 'xwin'.
I know it would be possible through a series of if, elif statements, but I'm sure there must be some way to do it without doing that preferrably. I'm just not sure on the syntax in this situation.
Any help would be much appreciated.