import random
def to_be_or_not_to_be():
return random.random() < 0.5
I think it is interesting, because even though it asks a clear question, the answer is... not entirely clear. It is a sad day when one realises his dreams are plagued by source code.
5 comments:
Very awesome :)
respect *= 100
There's no definition of the constant "towel" in there. And the answer always comes out to 0.42, anyway.
Perhaps
random.choice((True, False))
is a tad more readable than just random.random. :)
Or even:
random.choice(('2b', '!2b'))
to make the answer a tad clearer maybe?
Or even
"!2b"[random.random() > 0.5:]
Post a Comment