How to process and edit lists in a loop
I'm trying to make a program where you can input a word and it'll create list(s) (I'm not sure if I only need one list with different copies of the list or multiple different lists) with random values (EX: ['s','a','f','e']) that is the same length as the word you put in. Then it'll look at those list(s) and keep the values that match the user given word and replace the values that don't match with random values. I want it to repeat this process until there's one list that completely matches the user given word.
I've gotten it to generate a random list and check/ replace the random list values but only once (at least when testing it by using a set "random" list. You can see the list I use to test in the code below)
So my question is, how do I make it so that it'll keep looping and replacing values until they all match the user given word?
I'm just confused on if I need to be adding the random list(s) to a data base or is it fine to have them stored how they are?
And if they do need to be in a db, how would I go about doing that?
Also, should I be using lists or would it be easier/ possible to do this with just strings?
Thanks in advance! :)
There's a way that it doesn't have to do keep on replacing at all, just use a for loop
word = input("Enter a word: ") letter_list =  for x in word: letter_list.append(x)
I'm so sorry!! I totally missed your other messages!
While technically just keeping the list empty gives me the result of the list matching the user given word its not quite what I'm trying to do. What I'm trying to do is I'm trying to make it so that the program will, through trial and error, start with a completely random list and end up with a list that matches the user given list.
That being said I really really appreciate the help!! :)