Write a function that to sum the result of rolling two random dice n times
<p>Write a function DiceRoll(n) that inputs an integer n and produces n random numbers
between 1 and 6. Test your program for n = 12.</p>

<p>I got this for that : </p>

<pre><code>import random

def DiceRoll(n):
    x=[random.randint(1,6) for _ in range(n)]
    return x
</code></pre>

<p>Then,</p>

<p>Write a function TwoDiceRoll(n) that uses your function DiceRoll to sum the result of
rolling two random dice n times. Test your program for n = 12.</p>

<p>I do not have an idea how would I involve my DiceRoll function in order to get the sum. Would someone be able to help me out. </p>

<p><strong>Code:</strong></p>

<pre><code>import random

def TwoDiceRoll(n):
    d1=DiceRoll(n)
    d2=DiceRoll(n)
    dsum=[i+j for i,j in zip(d1, d2)]

    return d1,d2,dsum

def DiceRoll(n):
    x=[random.randint(1,6) for _ in range(n)]
    return x

x=DiceRoll(12)
print x

d1,d2,dsum=TwoDiceRoll(12)
print d1, "\n", d2, "\n", dsum
</code></pre>

<p><strong>Example Output:</strong> </p>

<pre><code># It will be different everytime because of random function.
[3, 2, 3, 6, 4, 3, 5, 4, 4, 4, 2, 4]
[1, 4, 1, 2, 4, 1, 6, 5, 2, 6, 6, 5]
[4, 2, 3, 1, 6, 3, 1, 5, 5, 2, 6, 3]
[5, 6, 4, 3, 10, 4, 7, 10, 7, 8, 12, 8]
</code></pre>

python sage dice