I'm attempting to create a simple dice roller, and I want it to create a random number between 1 and the number of sides the dice has. However, randint
will not accept a variable. Is there a way to do what I'm trying to do?
code below:
import random
a=0
final=0
working=0
sides = input("How many dice do you want to roll?")
while a<=sides:
a=a+1
working=random.randint(1, 4)
final=final+working
print "Your total is:", final