Q:

roll dice python

from random import randint

def roll_dice():
    print(f"Number is: {randint(1,6)}")

# Do this to simulate once
roll_dice()   

# Do this to simulate multiple times
whatever = 12 # Put the number of times you want to simulate here
for number in range(0,whatever):
    roll_dice()
0
import random
diceRoll = random.randint(1, 6)
print(diceRoll)
0

New to Communities?

Join the community