On 30/07/2008, sai krishna <[EMAIL PROTECTED]> wrote:
> I wanted to print out all the combinations of a given word.

A thought for you:

Let's say you want to find permutations of the string 'abcd'.  Some of
those permutations will start with 'a' -- how many?  Can you list all
the permutations starting with 'a'?  Do you see any connection between
that list and your solution for n == 3?

(hint: the following is a function for computing factorials.  Do you
understand it?

def fac(n):
  if n == 0:
    return 1
  else:
    return n*fac(n-1)
)

(also, another thought for you, once you've solved this problem: what
answer would you expect for the string 'aaa'?)

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to