I can make simple for loops in python like:
for i in range(10):
However, I couldn\'t figure out how to make more complex ones, which are re
You need to use a generator. You could implement this as follows:
def stepDown(n): while n>1: yield n n = n/2 for i in stepDown(n): print i # or do whatever else you wish.
Note that this generalizes easily to other complicated patterns you may have in mind.