0

I want to create a program that will take a string, and print out every possible combination of the string.

My idea is to turn the string into a list of letters:

scram = input()
scram = list(scram)

Then I would use a for loop to iterate through each letter:

for letter in scram:

The problem is that I would like to move the current letter to the beginning of the string, but I'm not sure how to do that. After that I would try print out every version of the list while the current letter is at the beginning of the list. How could I go about doing this?

Toby Speight
  • 27,591
  • 48
  • 66
  • 103
Alfurman
  • 1
  • 1
  • 7
    http://stackoverflow.com/questions/8306654/finding-all-possible-permutations-of-a-given-string-in-python – Aidenhjj Nov 10 '16 at 14:26
  • 2
    The first answer gives you a solution using python library functions. The 2nd shows you how to do it yourself. – Aidenhjj Nov 10 '16 at 14:28

0 Answers0