title: Why am I getting this TypeError: unsupported format string passed to NoneType.__format__
body: <p>I'm have to find the average for a column of numbers in csv file. I know there's easier ways to do this but my code keeps returning this error and I don't know why. TypeError: unsupported format string passed to NoneType.<strong>format</strong>.</p>
  <pre><code>def average_magnitude(file_name):
      magnitude = []
      row = []
  
      size = len(list(file))
      for each_line in file:
          each_line = each_line.strip()
          row = each_line.split(&quot;,&quot;)
          for each_num in file:
              s += each_num
          
          magnitude = s/size
          
  
  def main(file_name):
      magnitude = average_magnitude(file_name)
      print(&quot;The average earthquake magnitude is {:.2f}\n&quot;.format(magnitude))
  </code></pre>