I'm having a conceptual problem porting this from C to Python:
int p;
for (p = 32; p < 64; p += 2) {
if (some condition)
break;
do some stuff
}
return p;
Converting the loop to for p in range(32,64,2) does not work. This is because after the loop ends, p is equal 62 instead of 64.
I can do it with a while loop easily:
p = 32
while p < 64:
if (some condition):
break
do some stuff
p += 2
return p
But I'm looking for a Pythonic way.