title: TypeError: 'float' object is not iterable 3
body: <pre><code>import csv
  
  csvfile = open(r"C:\Users\Administrator\Downloads\canberra_2011_2012.csv")
  
  header = csvfile.readline()  
  csv_f = csv.reader(csvfile)   
  for row in csv_f:
      first_value = float(row[5]) 
      total = sum(first_value)
      length = len(first_value)
      average = total/length
      print("average = ",average)   
  </code></pre>
  
  <p>When i run this code, it said </p>
  
  <pre><code>TypeError: 'float' object is not iterable
  </code></pre>
  
  <p>But when I change the line 7 to</p>
  
  <pre><code>first_value = [float(row[5]) for row in csv_f
  </code></pre>
  
  <p>then it works. This confuses me, can anyone help me?</p>