title: Why the code doesn't recognize the assigned variable?
body: <p>I am trying to write a program in Python 3 that takes an int year larger than 1970 as an input and returns the increase in temperature from 1970 until that year. The formulas and constants are given. Python throws me an error: </p>
  
  <pre><code>File "4.5.py", line 28, in &lt;module&gt;
      int_years = int_year - 1970
  NameError: name 'int_year' is not defined
  </code></pre>
  
  <p>I am a beginner in Python so I have browsed possible solutions, but could not find any working ones.</p>
  
  <pre><code>def user_input():
      while True:
          int_year = int(input("Please enter a year greater than 1970 " ))
          try:
              if int_year &gt; 1970:
                  break
              else:
                  print("Please enter a year greater than 1970")
          except ValueError:
              print ("It is not a valid year. Try again. ")
      return int_year
  
  """CO2 level of January 1970"""
  c0 = 325.03
  
  """Current levels of CO2"""
  c1 = 411.97
  
  """Difference in CO2 levels between 1970 and now"""
  differenceCO = c1-c0
  
  """The average CO2 increase per year since 1970"""
  per_year_changedCO = ((differenceCO)/(2019-1970))
  
  """Diffrence in years between 1970 and user input year"""
  int_years = int_year - 1970
  
  """A projected CO2 level in user input year"""
  int_year_changedCO = c0+((int_years)*(per_year_changedCO))
  
  """A projected RF in any year"""
  RF = 5.35*(math.log((int_year_changedCO)/(c0)))
  
  """Increase in temperature from 1970 to user input year"""
  def predict_increase():
    temp_int_year = 0.5 * RF
    return temp_int_year
  
  print(temp_int_year)
  </code></pre>
  
  <p>I expect the program to recognize the variables I use in functions. Overall, I will appreciate any comments on the code.</p>