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?

2
  • 7
    stackoverflow.com/questions/8306654/… Commented Nov 10, 2016 at 14:26
  • 2
    The first answer gives you a solution using python library functions. The 2nd shows you how to do it yourself. Commented Nov 10, 2016 at 14:28

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.