# Programmer: Sriram Pemmaraju # Feb 13th, 2013 # This program simulates the roll of two six-sided dice # as many times as specified by the input. Then the program # outputs the number of times 7 shows up as the sum of the two # dice rolls import random n = int(raw_input("Enter the number of times you want the dice rolled: ")) counter = 0 # keeps track of the number of rolls numSevens = 0 # keeps track of the number of sevens # while-loop that simulates the roll of two six-sided dice n times while counter < n: # Roll two six-sided dice and compute the sum of the outcomes sumRolls = random.randint(1, 6) + random.randint(1, 6) # if sum is seven then update a counter called numSevens if sumRolls == 7: numSevens = numSevens + 1 counter = counter + 1 print "The number of sevens is", numSevens