This may be a simple task, but I am unsure of how to achieve this in Python.
I have a for loop executing on an index in Python. I have a unique value that is defined within each iteration that is cycled through the for loop.
I want to get the value of the NEXT or PREVIOUS for loop unique value. For example, I have:
counter = 0
for rect in rects:
randomnumber = random.randint(1,101)
if counter < len(rects)-1:
if rects[counter] - rects[counter+1]
pastrand = {get random value from PREVIOUS loop iteration}
randsubtract = randomnumber - pastrand
So how do I get the random number from the previous (or next) iteration to use in the CURRENT iteration in Python? For example:
randomnumber in rects[0]
randomnumber in rects[1]
How do I call specific values from iterations in for loops?