Anagram

arthur.siegel at rsmi.com arthur.siegel at rsmi.com
Wed Jan 23 13:44:31 EST 2002


I'd propose the following as "simplest" - in the
sense of the code reflecting  a naive
understanding of the concept, and  fundametal
programming operations with no magic.

Am I missing the handling of some degenerate
situations?

def f(s):
    i=len(s)
    x=1
    while i:
       x*=i
       i-=1
    print s,x

The permutation I have been trying to create rejects reversals as
duplicative (that part I have, thanks to responses to a prior post) -
accepts duplicats but rejects permutations where unique elements in the list
are less than some number  X , passed as an argurment.

Art





More information about the Python-list mailing list