title: How to repeat a while loop a certain number of times
body: <p>As seen <a href="https://stackoverflow.com/questions/17647907/for-or-while-loop-to-do-something-n-times">over here</a>, there are two ways to repeat something a number of times. But it does not seem to work for me, so I was wondering if anybody could help.</p>
  
  <p>Basically, I want to repeat the following 3 times</p>
  
  <pre><code> import random
   a = []
   w = 0
  
   while w&lt;4:
       x = random.uniform(1,10)
       print(x)
       print(w)
       a.append(w+x)
       print(a)
       w=w+1
  </code></pre>
  
  <p>Based on what the link says, this is what I did,</p>
  
  <pre><code> import random
   a = []
   w = 0
   r = 0
  
  
   while r &lt; 3: 
        while w&lt;4:
            x = random.uniform(1,10)
            print(x)
            print(w)
            a.append(w+x)
            print(a)
            w = w+1
        r += 1
  </code></pre>
  
  <p>But this doesn't seem to work. The while loop only repeats once instead of three times. Could anybody help me fix this problem?</p>