Python sudoku shortest code ever
def r(a):i=a.find('0');~i or exit(a);[m in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for j in range(81)]or r(a[:i]+m+a[i+1:])for m in'%d'%5**18] from sys import*;r(argv[1]) Src: http://www.scottkirkwood.com/2006/07/shortest-sudoku-solver-in-python.html Original Source: Mark Byer's site has some more Sudoku solvers (can be found on web archive as web site is down) Expalanation https://jakevdp.github.io/blog/2013/04/15/code-golf-in-python-sudoku/ NOTE "A=0 #False B=20#True print(A or B) #B A=1 #True B=0#False print(A or B) #A you might expect the result to be either True or False. Instead, Python does something a bit clever. If the result is False, it returns A (which, naturally, evaluates to False). If the result is True, it returns A if A evaluates to True, and B otherwise. We can use this fact to remove the if statement completely from the set comprehension