title: Python Error: 'numpy.float64' object has no attribute 'append'
body: <p>I am trying to run a simulation in which I do the following:</p>
  
  <ol>
  <li>Take 2000 random samples from a uniform distribution between 0 and 1</li>
  <li>Calculate the difference, du, between any sample and the one chosen before it</li>
  <li>Use that difference to calculate r=EXP(-a*du)</li>
  <li>Compare another random sample z to the calculated value of r</li>
  <li>Create a list of the random samples for which r>z, and discard all others</li>
  <li>Repeat this process until 2000 samples have been "accepted"</li>
  </ol>
  
  <p>Here is what I have thus far. When I run this code, I receive the error message "'numpy.float64' object has no attribute 'append'". Any ideas on how to fix this issue?</p>
  
  <pre><code>import numpy as np                                                          
  import matplotlib.pyplot as plt                                             
  import math                                                                 
  
  NP=np.random.uniform(0,1,size=(2000,))                                      
  a=np.linspace(0.1,2,num=20)                                                 
  
  for i in range(len(a)):                                                     
      dr = []                                                                 
      du = []                                                                 
      for j in range(1999):                                                   
          du=N[j+1]-N[j]                                                      
          r=math.exp(-a[i]*du)                                                
          z=np.random.uniform(0,1)                                            
          if r&gt;z:                                                             
              du.append(N[j+1])                                               
              dr.append(r)
  </code></pre>