I have a list that looks like this:
foo = ["z", "q", "t", "a", "p", "m", "n", "b", "c", "w", "l", "d", "f", "h",
"y", "e", "j", "k", "g", "i", "o", "r", "u", "s", "v", "x"]
and i have another list that looks like this:
bar = ["h", "e", "l", "l", "o", "m", "y", "n", "a", "m", "e", "i", "s", "r",
"e", "a", "l", "l", "y", "l", "o", "n", "g", "a", "n", "d"]
what i want to do is use the first element of foo, and replace the first element of bar with it, and so that the first element of foo is now always worth "h", so if "h" ever comes up in bar again, "z" (the first element of foo) is automatically put in. the second element of foo is then subbed in for the second element of bar (unless it’s "h") and then second element then becomes "e", and so on until the entirety or bar has been encrypted using foo for the letters. and then print the new bar but with the letters changed from the encrypton process.
It’s very simple, actually:
I’ll leave it to you to figure out the appropriate Python functions, as you’d benefit from learning how to do it by yourself.