Ask coding questions

← Back to all posts
Problem with list indexing?
kaedyngrice

Reposting because I made a mistake on my first post.
I'm making this word generator to help me make words for a conlang that I'm making. The program starts by creating the structure of the word using lists of empty strings, and then sounds are added. Here is the short version of the problem I am running into

Input:

Output:

Instead of going into the correct index and only the correct index, the string is put into the same index of every sublist that is the same length.

I know my code will look pretty clunky and repetitive to someone more experienced; I only learned the basics of python because I took a programming class in high school.

Voters
BearCoder01
kaedyngrice
Comments
hotnewtop
BearCoder01

I got this output: [['sk', 'ei', '']]. What output do you want?

kaedyngrice

@BearCoder01 The program is randomized. If you keep rerunning the program until you get an output with more than one sublist, you should see the problem I'm having

BearCoder01

@kaedyngrice Do you get an error if yes one which line?

kaedyngrice

@BearCoder01 No, I don't get any errors.