title: 'NoneType' object has no attribute 'format' python string
body: <p>I wrote a program in python to find compound interest (more like copied). This program was written in python 2 and I am having a problem on the last line <code>.format(years)</code>.</p>
  <p>I need to know what I can do with this code, and how to write it properly in Python 3. Also with the <code>{}</code> part in the last line. Should I change it to <code>%s</code>? The error says:</p>
  <blockquote>
  <p>&quot;AttributeError: 'NoneType' object has no attribute 'format'&quot;.</p>
  </blockquote>
  <p>My code looks like this :</p>
  <pre class="lang-py prettyprint-override"><code># Estimated yearly interest
  
  print (&quot;How many years will you be saving ? &quot;)
  years = int(input(&quot;Enter the number of years : &quot;))
  
  print(&quot;How much money is currently in your account ? &quot;)
  principal = float(input(&quot;Enter current amount in account : &quot;))
  
  print(&quot;How much money do you plan on investing monthly ? &quot;)
  monthly_invest = float(input(&quot;Monthly invest : &quot;))
  
  print(&quot;What do you estimate the interest of this yearly investment would be ? &quot;)
  interest = (float(input(&quot;Enter the interest in decimal numbers (10% = 0.1) : &quot;)))
  
  print(' ')
  
  monthly_invest = monthly_invest * 12
  final_amount = 0
  
  for i in range(0, years ):
      if final_amount == 0:
          final_amount = principal
      final_amount = (final_amount + monthly_invest) * (1 + interest)
  
  print(&quot;This is how much money you will have after {} years:  &quot;).format(years) + str(final_amount)
  </code></pre>