# roll dice and keep rolling until you quit # # load the random class # import random # # assume user wants to roll the dice # count = int(input("How many times should I roll the die? ")) # # now roll repeatedly until done # for i in range(count): # it's a 20-sided die; note we add 1 because the random number # generated is between 0 and 19 (20-1) inclusive; by adding 1, # we will print a number between 1 and 20 die = random.randrange(20) + 1 print("You rolled a 20 sided die and %2d came up." % die) print("Done!")