For reference you can also see see this question:
I am trying to finding every possible combination of adding a character to a string
Exactly as the other question I'm trying to get every single possible combination of the insertion of a character inside a string.
I don't understand how to implement the solution, specially how to get every combination of bits.
string = 'abc'
def generate_string(string):
number_of_combinations = 2**(len(string)-1)
str = ''
configurations = []
for i in range(number_of_combinations):
#somehow get a true/false configuration of dashes
#with abc i should have 8 possible configurations
#i would append every configuration to configurations list
for char in string:
str = str + char
#if the first char of configuration is true then add a '-', if false do nothing and so on for every char in the string
Can someone help me ?