How make the judge with for loop?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Oct 16 04:26:13 EDT 2016
On Sunday 16 October 2016 16:23, 380162267qq at gmail.com wrote:
> c="abcdefghijk"
> len=len(c)
> n is a int
> sb=[[] for i in range(n)]
>
> while (i < len) {
> for (int j = 0; j < n && i < len; j++)
> sb[j].append(c[i++]);
> for (int j = n-2; j >= 1 && i < len; j--) //
> sb[j].append(c[i++]);
> }
>
> How to translate to python? I tried but my python code is really stupid
I don't know. What language is your code written in, and what does it do?
I can guess what some of it probably does, because it looks like Python code,
but the for-loops are complicated and weird. What do they do?
It might help if you show the expected results.
--
Steven
git gets easier once you get the basic idea that branches are homeomorphic
endofunctors mapping submanifolds of a Hilbert space.
More information about the Python-list
mailing list