As seen over here, 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.
Basically, I want to repeat the following 3 times
import random
a = []
w = 0
while w<4:
x = random.uniform(1,10)
print(x)
print(w)
a.append(w+x)
print(a)
w=w+1
Based on what the link says, this is what I did,
import random
a = []
w = 0
r = 0
while r < 3:
while w<4:
x = random.uniform(1,10)
print(x)
print(w)
a.append(w+x)
print(a)
w = w+1
r += 1
But this doesn't seem to work. The while loop only repeats once instead of three times. Could anybody help me fix this problem?