title: Print the arithmetic average, the youngest and oldest age
body: <p>This Python program should read a birth year until the number zero is entered.<br>
  The program should then print out the average age and how old the youngest and oldest is.</p>
  <p>I need help with two things.</p>
  <ol>
  <li>Print &quot;Unreasonable age, please try again&quot; when input year is -N, like &quot;-45&quot;</li>
  <li>Print the result i.e. the arithmetic average, the youngest and oldest <strong>only</strong> when I exit the loop.
  That means when I enter 0.</li>
  </ol>
  <p>Current output:</p>
  <pre><code>Please type in birth year, to stop, enter 0: 1948
  Average age is  72.0 years old.
  The younges is 72 years old,  and the oldest is  72 years old.
  Please type in birth year, to stop, enter 0: 1845
  Unreasonable age, please try again
  Average age is  72.0 years old.
  The younges is 72 years old,  and the oldest is  72 years old.
  Please type in birth year, to stop, enter 0: 1995
  Average age is  48.5 years old.
  The younges is 25 years old,  and the oldest is  72 years old.
  Please type in birth year, to stop, enter 0: 2005
  Average age is  37.333333333333336 years old.
  The younges is 15 years old,  and the oldest is  72 years old.
  Please type in birth year, to stop, enter 0: 0
  Average age is  37.333333333333336 years old.
  The youngest is 15 years old,  and the oldest is  72 years old.
  </code></pre>
  <p>Expected output that I want:</p>
  <pre><code>Please type in birth year, to stop, enter 0.
  Year: 1998
  Year: 1932
  Year: 1887
  Fail: Unreasonable age, please try again.
  Year: 1987
  Year: -77
  Fail: Unreasonable age, please try again.
  Year: 1963
  Year: 0
  Average age is 49 years old. The youngest is 21 years old, and the oldest is 87 years old.
  </code></pre>
  <p>Example code:</p>
  <pre class="lang-py prettyprint-override"><code># set number_years to zero     ### Initial value (has not started counting yet)
  number_year = 0
  # set number_years to zero     ### Initial value (has not started counting yet)
  sum_year = 0
  # set sum_year to zero    ### No maximum age yet
  max_year = 0
  # set max_year to zero      ### Well increased minimum value (age) to start with
  min_year = 110
  # set input_year to minus 1 ### Only as start value for the sake of the loop start!
  input_year = -1
  
  # White input_year is not 0:
  while input_year != 0:
      # print info and store input value to input_year, stop if 0 is entered
      input_year = int(input(&quot;Please type in birth year, to stop, enter 0: &quot;))
      # let age be (2020 - input_year)
      age = (2020 - input_year)
      # To avoid beauty flaws with the printout &quot;Unreasonable year ...&quot;
      # when the final zero is entered, we must check that age is not 2020
      # which it is deceptive enough because 2020-0=2020
  
      # if age is less than zero or age is greater than 110 and age is not 2020:
      if age &lt; 0 or age &gt; 110 and age != 2020:
          # Print &quot;Unreasonable age, please try again&quot;
          print(&quot;Unreasonable age, please try again&quot;)
      # else
      else:
          # if input_year is greater than zero:
          if input_year &gt; 0:
              # increase number_year with 1
              number_year += 1
              # let sum_year become sum_year + age
              sum_year = sum_year + age
              # if age is less than min_year:
              if age &lt; min_year:
                  # set min_year to age ### New minimum age found
                  min_year = age
              # if age is bigger than max_year:
              if age &gt; max_year:
                  # set max_year to age ### New maximum age found
                  max_year = age
  
      ## If the entered number was 0, exit the loop
      #if input_year == 0:
      #    break
  
      # Now just print the arithmetic average, the youngest and oldest
      # Print &quot;Average age is &quot;, sum_year / number_year, &quot;year.&quot;
      print(&quot;Average age is &quot;, sum_year / number_year, &quot;years old.&quot;)
      # Print &quot;The younges is &quot;, min_year, &quot; and the oldest is &quot;, max_year
      print(&quot;The youngest is&quot;, min_year, &quot;years old,&quot;, &quot; and the oldest is &quot;, max_year, &quot;years old.&quot;)
  
  # Done! :-)
  
  </code></pre>