for example this kind of for loop in JAVA or C++:
int N = 20;
for (i = 1; i < N; i = 3 * i + 1)
i will be 1, 4, 13
I can only use while to complete it
while i < N:
i = 3 * i + 1
How can write it using another kind of style in python?
Sorry for my English.
3 * i + 1, I would suggest looking intorangebut the step argument it accepts expects an integer. You could write your own version though.style in python, for which that loop is not the typical style regardless of whether it is valid.