Trick or treat? solution in Clear category for Xs and Os Referee by veky
diags = ([row[i], row[~i]] for i, row in enumerate(result))
for lines in result, zip(*result), zip(*diags):
for a, b, c in lines:
if a == b == c in 'OX': return a
else: return 'D'
Nov. 3, 2015