New to Programming: Creating a kids adding game in python
<p>I'm new to programming and having trouble with a problem I have for homework. Here is the homework problem:</p>

<p>Develop a simple game that teaches kindergartners how to add single-digit numbers. Your function <code>game()</code> will take an integer n as input and then ask n single-digit addition questions. The numbers to be added should be chosen randomly from the range [0,9] (i.e., 0 to 9 inclusive). The user will enter the answer when prompted. Your function should print “Correct” for correct answers and “Incorrect” for incorrect answers. After n questions, your function should print the number of correct answers. </p>

<p>For example:</p>

<pre><code>&gt;&gt;&gt;game(3)
8+2=
Enter answer: 10
Correct.
6+7 =
Enter answer: 12
Incorrect.
7+7=
Enter answer: 14
Correct.

You got 2 correct answers out of 3
</code></pre>

<p>Here's what I have so far:</p>

<pre><code>def game(n):
  x = random.randrange (0,10)
  y = random.randrange(0,10)
  numbers = (x+y)
  print (x, "+", y)
  guess = eval(input("Enter your guess: "))
  count = 0
  total = 0
  while total &lt;= n:
    if guess == numbers:
      count = count + 1
      total = total + 1
      print("Correct.")
      break
    elif guess != numbers:
      total = total + 1
      print("Inncorrect")
      break
  return ("You got" + sum(count) + "correct answers out of" + sum(total))
</code></pre>

<p>I can get to where it states whether the answer is correct or not but can't figure out how to get it to run n times and display the results. </p>

<p>Any hints would be greatly appreciated!</p>
