From a6cc35afb6429762759b35fe3f88c9e78f0d7127 Mon Sep 17 00:00:00 2001 From: Jesse O'Connor Date: Sun, 5 Aug 2018 23:24:15 +1000 Subject: [PATCH] Use condition in while rather than separate if clause While loops evaluate a condition so we might as well use them --- Diceroll.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Diceroll.py b/Diceroll.py index 5dfcec8..435ef73 100644 --- a/Diceroll.py +++ b/Diceroll.py @@ -15,10 +15,8 @@ print ("You rolled...") count = 0 #while loop repeats roll for how many dice are set - while True: + while count < DICE: print (random.randint(MIN, MAX)) count += 1 - if count >= DICE: - break #ask user if they want to roll again ROLLAGAIN = input("Roll again?").lower()