Apr-04-2019, 06:37 PM
So I am very new to python, and I am trying to make a simple dice roll simulator. But when I try to loop the program it just doesn't do anything, I've done loops before and am pretty familiar with them (for a noob), but it just doesn't seem to work.
This is the code:
This is the code:
import random z=1 while z==1: y = 1 n = int(input("How many dice do you want to roll?: ")) counter1 = 0 counter2 = 0 counter3 = 0 counter4 = 0 counter5 = 0 counter6 = 0 for x in range (1,n+1): t = random.randint(1,6) while y <= n: if t == 1: counter1 += 1 elif t == 2: counter2 += 1 elif t == 3: counter3 += 1 elif t == 4: counter4 += 1 elif t == 5: counter5 += 1 elif t == 6: counter6 += 1 for x in range (1,n+1): t = random.randint(1,6) y += 1 print("1: ", counter1, " times, 2: ", counter2, " times, 3: ", counter3, " times 4: ", counter4, " times, 5: ", counter5, " times, 6: ", counter6, " times.") z=2 z = int(input("Write 1 to try again: "))