dice function python code example
Example 1: how to make a dice in python
from random import randint
dice_roll = randint(1,6)
print("You Threw a", dice_roll)
import time
from random import randint
for j in range(10):
dice_roll = randint(1,6)
time.sleep(3)
print("You threw a", dice_roll)
Example 2: how to make a dice program in python
import random
run = 1
level = 0
while(run == 1):
print("**ROUND " + str(level) + "**")
print("player 1: ",random.randint(0, 6))
print("player 2: ",random.randint(0, 6))
run = int(input("enter 1 to go again or 0 to end: "))
print("")
level += 1