title: Float object has no attribute
body: <p>How can I fix the error in my code. Whenever I try to run it, the 'float' object has no attribute '<strong>getitem</strong>' keeps on appearing. I am trying to put all the computed values in a table-like format but the error keeps on appearing. 
  Here is the code. It's a bit longer than I imagine. The error is at the end in for i in range...</p>
  
  <pre><code>sumlat = 0.0
  sumdep = 0.0
  sumdist = 0.0
  lat1 = []
  dep1 = []
  d1 = []
  northings = []
  eastings = []
  adjdep = []
  adjlat = []
  
  import math
  n = input('\nEnter Number of Corners:')
  northings += [input('Northings of Point 1:')]
  eastings += [input('Eastings of Point 1:')]
  
  def compLatDep (b, d): #function compLatDep
      return (b, d)
  def degAzi (deg, mi, sec): 
      return (deg, mi, sec)
  
  #I.
  for i in range (0,n):
      if n &gt; i+1:
          print '\nLine %d-%d.' % (i+1, i+2)
  else:
      print '\nLine %d-%d.' % (i+1, 1)
      b = raw_input('Azimuth (from the South in D-M-S):') #follow the format     in entering the given azimuth
      myString = b
      deg = myString.split("-")[0] #myString.split("-") method results to an input string split and returned the list of string split
      deg = float(deg)
      mi = myString.split("-")[1]
      mi = float(mi)
      sec = myString.split("-")[2]
      sec = float(sec)
      decimal = deg + (mi/60) + (sec/3600) #conversion of dms into decimal degrees
      d = input('Distance (in meters):')
      d1 += [d]
      sumdist += d
      lat, dep = compLatDep (b,d)
      dep = -d * math.sin(math.radians(decimal)) #the azimuth should be converted into radians for this import/formula to work, given formula in finding the dep of a corner
      dep1 += [dep]
      sumdep += dep
      lat = -d * math.cos(math.radians(decimal)) #given formula in finding the lat of a corner
      lat1 += [lat]
      sumlat += lat
  </code></pre>
  
  <h1>II. Corrections and adjustments to be applied in each corner</h1>
  
  <pre><code>for i in range(len(dep1)):
      corr = -sumdep *  d1[i] / sumdist #formula in finding the correction to be applied in each departure
      corrdep = corr + dep1[i] # formula for corrected departure of each corner
      adjdep += [corrdep]
  for i in range(len(lat1)):
      corr = -sumlat *d1[i] / sumdist #formula in finding the correction to be applied in each latitude
      corrlat = corr + lat1[i] #formula for corrected latitude of each corner
      adjlat += [corrlat]
  for i in range(len(lat1)):
      north = northings [i] + lat1 [i]
      northings += [north]
  for i in range(len(dep1)):
      east = eastings [i] + dep1 [i]
      eastings += [east]
  </code></pre>
  
  <h1>III. REC and LEC</h1>
  
  <pre><code> LEC = math.hypot(sumlat, sumdep) #imported from math module to find the LEC     of a closed loop traverse
   print '\n\tLEC: %f' % LEC
   print '\tREC: 1:', (sumdist/LEC)
   print '\t   : 1:', (int(sumdist/LEC)) #rounded down to the nearest integer
  </code></pre>
  
  <h1>IV. (this has a problem)</h1>
  
  <pre><code> print '%s\t%10s\t%14s\t%14s\t%14s\t%14s\t%14s' % ('Line', 'Azimuth', 'Distance', 'Adj Lat', 'Adj Dep', 'Northings', 'Eastings')
  
  for i in range (1,(n+1)):
       if(i == n):
          print '%d-%d\t%10f\t%14f\t%14f\t%14f\t%14f\t%14f' %(i, 1, decimal[i], d1[i], adjlat[i], adjdep[i], northings[i], eastings[i])
      else:
          print '%d-%d\t%10f\t%14f\t%14f\t%14f\t%14f\t%14f' %(i, i + 1, decimal[i], d1[i], adjlat[i], adjdep[i], northings[i], eastings[i])
  </code></pre>