title: calculating average in python?
body: <p>the question is:</p>
  
  <blockquote>
    <p>Ask the user how many children she has.  Input the ages for each child (ensuring that the value is a number between 0 and 100).  Calculate and output the average age of the user’s children.</p>
  </blockquote>
  
  <p>and here is what I have so far:</p>
  
  <pre><code>child = int(input("How many children do you have?"))
  count = 1
  total = 0
  if child &gt; 100:
      print("Invalid!")
  else:
      while count &lt;= 11:
          n = int(input("Enter child #%s" %str(count)+ " age:"))
          count += 1
          total += n
  
      print("Average age:", total/child)
  </code></pre>
  
  <p>I can't set the numbers of children. for instance, when I input 3 or 7 children for the question (How many children do you have?), it still lets me input ages for 11 children. I know I have set it to &lt;= 11 but I don't know how else to do it?? Also, this is my attempt for a <code>while-loop</code>, I still need to do it using a <code>for-loop</code>?? And does it look alright overall?</p>