title: Python TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
body: <p>I am a student and am pretty new to python. I am trying to validate the user input to check whether or not they entered a 3 digit number, they should only be able to enter a 2 digit number. The program works fine when the user enters only 2 digits but when they enter 3 or more, it throws the error message I created and asks them to re-enter a number that is only 2 digits, then once they re-enter a 2 digit number python gives me the TypeError. The full error I am getting is: </p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/admin/Desktop/week6/question_7.py", line 87, in &lt;module&gt;
  
    File "/Users/admin/Desktop/week6/question_7.py", line 79, in do_stuff
      print (display_grade(user_in))
  TypeError: int() argument must be a string, a bytes-like object or a 
  number, not 'NoneType'
  </code></pre>
  
  <p>I am having trouble figuring out why it is doing this. I have a feeling it has something to do with the calling the get_input() function inside of itself? I can't figure out how to avoid this though. </p>
  
  <p>I searched the error I keep getting and couldn't find anything that helped. </p>
  
  <p>Here's the program, it's pretty simple. </p>
  
  <pre><code> NUMBER_OF_TESTS = 5
  
  def get_input ():
      print ('enter a test score below')
      user_in = input()
      if len(user_in) &gt; 2:
          print ('error, you can only enter a 2 digit number.')
          get_input()
      else:
          return user_in
  
  def display_grade (letter_grade):
      if letter_grade &gt;= 89:
          return ('You got an A!')
      elif letter_grade &gt;= 80 and letter_grade &lt;= 89:
          return ('You got a B!')
      elif letter_grade &gt;= 70 and letter_grade &lt;= 79:
          return ('You got a C')
      elif letter_grade &gt;= 61 and letter_grade &lt;= 69:
          return ('You got a D')
      else:
          return ('You got an F')
  
  def calAverage(total):
      average_score = (total) / NUMBER_OF_TESTS
      return int(average_score)
  
  def do_stuff():
      i = 0
  
      x = 0
  
      while i &lt; NUMBER_OF_TESTS:
          user_in = int(get_input())
          print (display_grade(user_in))
          x = x + user_in
          i = i + 1
      print ('your average score is' , calAverage(x) , 'which means' , display_grade(calAverage(x)))
  
  
  
  do_stuff()
  </code></pre>