I have some problems with this small program for rolling two dices.
Why the program stops before it finishes the loop and instead it asks a loop times "do you want to play again?"
Thank you for your help!
#Program which simulates the rolling of two dice
import random
def rolling_dices(repetitions):
a = repetitions
b = 1
while b <= a:
i = (random.randrange(1,7))
y = (random.randrange(1,7))
b +=1
print(i, y, "\t =>", int(i+y))
answer = input("do you want to play again? (Y/N)")
if answer.lower() == "y":
continue
else:
break
rolling_dices(5)
Aucun commentaire:
Enregistrer un commentaire