import random
#2a
def dice_roll(n = 6):
    roll1 = random.randint(1, n) # dice roll 1
    roll2 = random.randint(1, n) # dice roll 2
    return (roll1 + roll2)       # return sum of dice rolls
#2b
def dice_roll_multiple_times(p, n = 6, m = 1000):
    count = 0
    p_occurrence = 0
    while count < m:
        roll = dice_roll(n)     # call our 2 dice roll function
        if p == roll:           # check if the dice roll sum is equal to our number
            p_occurrence = p_occurrence + 1 # update the count of the occurrence of our number
        count = count + 1       # update our iteration count    
    return p_occurrence         # return the number of time the number occurred     

#2c
number = 2                  # our first number is 2
while number <= 12:         # check if number is less than or equal to 12
    result = dice_roll_multiple_times(number) # call the function for occurrence count
    print number, "occurs",  result, "times"
    number = number + 1     # update our number
