Problem with algorithm

Paul McGuire ptmcg at austin.rr.com
Fri Apr 13 10:19:49 EDT 2007


On Apr 13, 8:53 am, Steve Holden <s... at holdenweb.com> wrote:
> Jia Lu wrote:
> >> for m in test:
> >>     for n in test:
> >>         for o in test:
> >>             for p in test:
> >>                 print m+n+o+p
>
> > Thanx for your anwser.
> > But if I consider about a combination of over 26 letter's list just
> > like:
> > "abcdefssdzxcvzxcvzcv"
> > "asllxcvxcbbedfgdfgdg"
> > .....
>
> > Need I write 26 for loops to do this?
>
> > Thanx
>
> > Jia LU
>
> Your new example uses 20-byte strings anyway, so to produce those using
> the specified method you would need 20 nested for loops, not 26.
>
> I'm pretty sure you could give a separate name to each atom ont he known
> universe with a scheme like this.  Do you really need 20-byte strings?
>
> regards
>   Steve
> --
> Steve Holden       +44 150 684 7255  +1 800 494 3119
> Holden Web LLC/Ltd          http://www.holdenweb.com
> Skype: holdenweb    http://del.icio.us/steve.holden
> Recent Ramblings      http://holdenweb.blogspot.com- Hide quoted text -
>
> - Show quoted text -

If you just expand the length to five million* or so, one of those
strings will contain all the works of Shakespeare.

-- Paul
* ref: Project Gutenberg - http://www.gutenberg.org/etext/100 -
unzipped plaintext is ~5.3Mb




More information about the Python-list mailing list