(Python) Generating Numbers then Printing them on One Line
<p>I have an assignment that requires me to print 10 random sums, then get the user to enter their answers. I know how to randomly generate numbers, but I need to print the whole sum out, without giving the answer, but with the string I am using it adds them automatically.</p>

<p>This is my code below:</p>

<pre><code>for i in range(10):
        number1 = (random.randint(0,20))
        number2 = (random.randint(0,20))
        print (number1 + number2)
    answer = input("Enter your answer: ")
</code></pre>

<p>If someone could help me out I would appreciate it, I believe the line</p>

<pre><code>    print (number1 + number2)
</code></pre>

<p>is the problem, as it is adding them when I just want the random numbers printed in the sum.</p>

<p>Thanks in advance,</p>

<p>Flynn.</p>

<p>Try this,  </p>

<pre><code>print number1, '+', number2   
</code></pre>

python random numbers sum