I have a following loop in C:
for (i = 0, j = nvert-1; i < nvert; j = i++) {
//do something
}
I want to write this loop in python. I know that in Python the loop uses the range(start,end) format, so I think I should make this somehow as follows:
for i in range(0,nvert):
for j in range(???):
#do something
so my problems are with this:
- how can I determine the range of j?
- how can I do the
j=i++trick in python (so this loop would act the same as the C-loop above)?
j=i++trick in Python unfortunatelyfor (i = 0; i < n; ++i) a[i];in C, you could writefor item in a: itemin Python. If you want a circular buffer; look atcollections.deque()