Iterate through a string with various possible characters

I just signed up here because I am taking an online Python course and using this site to help me take the course. I; however, stuck.

I am not posting my actual homework, but rather as an element of my code. I have a difficult time with ...

I am trying to iterate through a string using a list containing letters in the alphabet. I want each letter in the list to iterate over a word in different indexes. For instance:

word = "panda" char_list = ['a', 'b', 'c'], etc. .... The output should be aanda, panda, paada ...... The following are the gang, pbnda, pabda, ...

My code iterates through the word using only the first character in the list. Sorry, I'm super NEW for coding in general ...

index = 0
word = "panda"
possible_char = ['a', 'b', 'c', 'd', 'o']
for char in possible_char:
    while index < len(word):
        new_word = word[:index] + char + word[index + 1:]
        print (new_word)
        index = index + 1
+4
5

while for, index reset len(word) , . , 0 :

for char in possible_chars:
    index = 0
    while index < len(word):
        #...
+1

. , reset . for index=0.

+1
index = 0
word = "panda"
possible_char = ['a', 'b', 'c', 'd', 'o']
for char in possible_char:
    index = 0
    while index < len(word):
        new_word = word[:index] + char + word[index + 1:]
        print (new_word)
        index = index + 1

forloop,

+1

, reset 0 , char.

index = 0
word = "panda"
possible_char = ['a', 'b', 'c', 'd', 'o']
for char in possible_char:
   index=0
   while index < len(word):
      new_word = word[:index] + char + word[index + 1:]
      print (new_word)
      index = index + 1
+1

for:

index = 0
word = "panda"
possible_char = ['a', 'b', 'c', 'd', 'o']
for char in possible_char:
    index = 0
    while index < len(word):
        new_word = word[:index] + char + word[index + 1:]
        print (new_word)
        index = index + 1
0

All Articles