Change coin to be more pythonic

This commit is contained in:
Eitan Adler 2013-04-07 23:06:13 -04:00
parent c96c05ac6d
commit 8c2b56960e

View File

@ -2618,7 +2618,8 @@ def coin(cli, nick, chan, rest):
cli.msg(chan, "\2{0}\2 tosses a coin into the air...".format(nick))
var.LOGGER.logMessage("{0} tosses a coin into the air...".format(nick))
cmsg = "The coin lands on \2{0}\2.".format("heads" if random.random() < 0.5 else "tails")
coin = random.choice(["heads", "tails"])
cmsg = "The coin lands on \2{0}\2.".format(coin)
cli.msg(chan, cmsg)
var.LOGGER.logMessage(cmsg)