From 28d5ce30786ba05d1ca30076ee67d9a27dc4f133 Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Thu, 14 Jul 2016 10:15:13 -0500 Subject: [PATCH] Replaced for loop with genexp --- cogs/core.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cogs/core.py b/cogs/core.py index 4b9a21d..3a54af8 100644 --- a/cogs/core.py +++ b/cogs/core.py @@ -103,18 +103,18 @@ class Core: except ValueError: await self.bot.say("Please provide the die notation in #d#!") return - if dice == '': - dice = '1' + dice = dice or '1' if dice > 10: await self.bot.say("I'm not rolling more than 10 dice, I have tiny hands") return if num > 100: await self.bot.say("What die has more than 100 sides? Please, calm down") return - valueStr = str(random.randint(1, num)) - for i in range(1, int(dice)): - value = random.randint(1, num) - valueStr += ", {}".format(value) + #valueStr = str(random.randint(1, num)) + valueStr += ", ".join("{}".format(random.randint(1, num)) for i in range(1, int(dice))) + #for i in range(1, int(dice)): + #value = random.randint(1, num) + #valueStr += ", {}".format(value) if int(dice) == 1: fmt = '{0.message.author.name} has rolled a {2} sided die and got the number {3}!'