Python hacking and data visualization.
def chesssquare(square): """Return the color of a chessboard square.""" rank,file=square return ord(file) & int(rank) & 1 and 'black' or 'white'In [1]: chesssquare('a1')Out [1]: 'black'In [2]: chesssquare('A2')Out [2]: 'white'
Post a Comment
0 comments:
Post a Comment