I’m new to python, and I just wanted to ask how you would match one element from a user input to a list. I’m currently working on a caesar cipher program, and I basically typed up a list of the alphabets: alphabet = ['a','b','c','d',...]
Then asked the user for a word to encrypt, text = input('Enter your message')
and the shift amount, I figured I could set an empty string variable and then loop through (for loop) each letter to shift it.
But this is where I got stuck, how will I shift each letter in the input by the shift amount using the list?
I tried to loop through the input using the indexes of the list alphabet, but since had no idea what I was doing it didn’t work.
Soham Karalkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.