title: How to fix a problem when user-defining goes wrong
body: <p>I am completely new to programming, now im struggling on a little program where the "grade" wont get defined. Thank you</p>
  
  <p>I tried return grade but it wont work anyway</p>
  
  <pre><code>def computegrade(score,grade):
       try:
          if score &gt;1.0001:
              grade= print("invalid score")
          elif score &lt; -0.0001:
              grade= print("invalid score")
          elif score &gt;= 0.9:
              grade= print("A")
          elif score &gt;= 0.8:
              grade= print("B")
          elif score &gt;= 0.7:
              grade= print("C")
          elif score &gt;= 0.6:
              grade= print("D")
          elif score &lt; 0.6:
              grade= print("F")
      except:
          print("Invalid")
      return grade
  
  score=input("Enter your Score(between 0.0-1.0)\n")
  grade=computegrade(score,grade)
  </code></pre>
  
  <p>Please fix the problem that "grade"  gets defined correctly.Thanks :)
  When you enter e.g. 0.7,it says : grade=computegrade(score,grade)
  NameError: name 'grade' is not defined</p>