Re: [Tutor] Obtaining various combinations of a given word

2008-07-29 Thread Brendan
sai krishna gmail.com> writes: > > > Hi,everyone.My name is Sai krishna, and I'm new to Python as well as Programming.I wanted to print out all the combinations of a given word.I am doing it this way: > n='cat'def arrange(n):if len(n)==1: #length of word is 1    print nelif len(n)==2: # length

Re: [Tutor] Obtaining various combinations of a given word

2008-07-29 Thread John Fouhy
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 star

Re: [Tutor] Obtaining various combinations of a given word

2008-07-29 Thread Vivek Sant
Hi Sai krishna, I recently wrote a program that does something similar to what you want. If you are familiar with the game text-twist, I wrote up a "solver" that will untwist any word by generating all possible combinations and then checking against a dictionary. To be honest, I had a lit

Re: [Tutor] Obtaining various combinations of a given word

2008-07-29 Thread bob gailer
sai krishna wrote: Hi,everyone. My name is Sai krishna, and I'm new to Python as well as Programming. Welcome. I wanted to print out all the combinations of a given word. More precisely you want to print all the combination of the letters in a given word. I am doing it thi

[Tutor] Obtaining various combinations of a given word

2008-07-29 Thread sai krishna
Hi,everyone. My name is Sai krishna, and I'm new to Python as well as Programming. I wanted to print out all the combinations of a given word. I am doing it this way: n='cat' def arrange(n): if len(n)==1: #length of word is 1 print n elif len(n)==2: # length of word is 2 print n[0]+n[1]