I like that lambda trick. I was hoping Crash would actually crash the program so you could tell if you won by looking at the error it gives (if its KeyboardInterrupt or something else).
Here's mine.
$ python -c 'import random;L=sorted(str(random.randint(1,9)) for i in range(4));a=raw_input(L);print(eval(a)==24,sorted(filter(str.isdigit,a))==L)'
['2', '6', '7', '8']8*(7+2-6)
(True, True)
Try to make it print (True, True) without abusing eval too much (intended to be +-*/() only with digits as tokens).
A nicer interface, but too long:
import random;L=sorted(str(random.randint(1,9)) for i in range(4));a=raw_input(" ".join(L)+"\n> ");print(eval(a)==24,sorted(filter(str.isdigit,a))==L)
throwathrowaway|10 years ago
Here's mine.
Try to make it print (True, True) without abusing eval too much (intended to be +-*/() only with digits as tokens).A nicer interface, but too long:
simi_|10 years ago
http://i.imgur.com/GEMAeM8.png
vanous|10 years ago
eigenbom|10 years ago