Problem with algorithm

Steve Holden steve at holdenweb.com
Fri Apr 13 09:53:43 EDT 2007


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




More information about the Python-list mailing list