CP4E? (was: Help - just a few lines of code needed)

2006-03-07 Thread Cameron Laird
In article <[EMAIL PROTECTED]>,
 <[EMAIL PROTECTED]> wrote:
>There is some fine permutation code in the cookbook.  Take a look at
>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465 .
>
>You can easily code something like:
.
.
.
>> Unfortunately I am not able to program it myself, so
>> I would appreciate if someone could write this piece of
>> software, compile it (for DOS or Windows) and send the .exe file to:
>>
>> lory88 at gmail . com
>
>Meet us halfway, here.  At least install Python.
>
>Also, it's a dangerous world out there.  Don't run .exe s sent to you
>by people you don't know.
>

All true.

This situation rather intrigues me at what I'll call a
managerial level.  I'm sympathetic to the possibility 
that Lory might have a life where compilation and 
script-launching and our other commonplaces are very
remote; I salute him or her for recognizing that 
string permutation is indeed a feasible goal for a
simple .EXE.  I know *I* sometimes am in the situation
of not having a useful Windows installation of a C
compiler, or adequate Java environment, or ..., and I
lean on the kindnesss o strangers at least temporarily.

At the same time, there's little incentive for
comp.lang.python to take on the burden of application
development for transients in Pythonia.  Lory, we can
walk you through the "at least install Python" part Mr.
Zenger mentions above in ten minutes; truly, it'll take
less time than it would to negotiate delivery of a 
special-purpose executable for you.

I remain curious:  how'd you come to Python for your
need?  Is there some particular reason--most likely,
that you're a potential Python student yourself--that
we should help you?  Is there a reason--that this is
an assignment you're to do on your own?--that we should
*not*?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help - just a few lines of code needed

2006-03-06 Thread johnzenger
There is some fine permutation code in the cookbook.  Take a look at
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465 .

You can easily code something like:

# xcombinations from the cookbook
def xcombinations(items, n):
if n==0: yield []
else:
for i in xrange(len(items)):
for cc in xcombinations(items[:i]+items[i+1:],n-1):
yield [items[i]]+cc

wordlist = ['HOUSE','jolly','---','0&','99']

for i in xrange(1, len(wordlist)+1):
for g in xcombinations(wordlist, i):
print "".join(g)


> Unfortunately I am not able to program it myself, so
> I would appreciate if someone could write this piece of
> software, compile it (for DOS or Windows) and send the .exe file to:
>
> lory88 at gmail . com

Meet us halfway, here.  At least install Python.

Also, it's a dangerous world out there.  Don't run .exe s sent to you
by people you don't know.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help - just a few lines of code needed

2006-03-06 Thread James Stroud
[EMAIL PROTECTED] wrote:
> Unfortunately I am not able to program it myself, so

You should learn how. Its very easy and will make your life better.

Go to www.python.org.

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Help - just a few lines of code needed

2006-03-06 Thread lory88
Hi

I hope someone can help me out with a very SIMPLE program
about whole string permutations. That is: given a list of strings,
the required outcome is a complete set of all their possible
permutations.
It's like character permutations of a string, but this time it is
whole strings instead of single characters that have to be permuted.

I need this because I don't remember exactly the password to open
my zipped archives, but i do remember the bits of strings
that made up the long passphrase.

Could someone kindly write a simple program that, after reading a set
of
strings contained in a .txt file (one string on each line),
produces as output another .txt file containing all the possible
permutations/combinations of those strings.

For example, the text file with the set of strings may contain:

HOUSE
jolly
---
0&
99


and the output file contains:

HOUSE
HOUSEjolly
HOUSE---
HOUSE0&

and so on...
...with the word combinations growing extensively,
so as to exhaust all the possibilities:

e.g.

---99jolly0&
jolly0&---99HOUSE

etc. etc.

Unfortunately I am not able to program it myself, so
I would appreciate if someone could write this piece of
software, compile it (for DOS or Windows) and send the .exe file to:

lory88 at gmail . com


I thank you all in advance.

Lory

-- 
http://mail.python.org/mailman/listinfo/python-list